Пример #1
0
/*
 * Print character stat in given row, column
 */
static void prt_stat(int stat, int row, int col)
{
	char tmp[32];

	/* Display "injured" stat */
	if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
	{
		put_str(stat_names_reduced[stat], row, col);
		cnv_stat(p_ptr->state.stat_use[stat], tmp, sizeof(tmp));
		c_put_str(TERM_YELLOW, tmp, row, col + 6);
	}

	/* Display "healthy" stat */
	else
	{
		put_str(stat_names[stat], row, col);
		cnv_stat(p_ptr->state.stat_use[stat], tmp, sizeof(tmp));
		c_put_str(TERM_L_GREEN, tmp, row, col + 6);
	}

	/* Indicate natural maximum */
	if (p_ptr->stat_max[stat] == 18+100)
	{
		put_str("!", row, col + 3);
	}
}
Пример #2
0
/*
 * Display the experience
 */
static void prt_exp(int row, int col)
{
	char out_val[32];
	bool lev50 = (p_ptr->lev == 50);

	long xp = (long)p_ptr->exp;


	/* Calculate XP for next level */
	if (!lev50)
		xp = (long)(player_exp[p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp;

	/* Format XP */
	strnfmt(out_val, sizeof(out_val), "%8ld", (long)xp);


	if (p_ptr->exp >= p_ptr->max_exp)
	{
		put_str((lev50 ? "EXP" : "NXT"), row, col);
		c_put_str(TERM_L_GREEN, out_val, row, col + 4);
	}
	else
	{
		put_str((lev50 ? "Exp" : "Nxt"), row, col);
		c_put_str(TERM_YELLOW, out_val, row, col + 4);
	}
}
Пример #3
0
/*
 * Print character info at given row, column in a 13 char field
 */
static void prt_field(cptr info, int row, int col)
{
	/* Dump 13 spaces to clear */
	c_put_str(TERM_WHITE, "             ", row, col);

	/* Dump the info itself */
	c_put_str(TERM_L_BLUE, info, row, col);
}
Пример #4
0
/**
 * Prints current shape, if not normal.   -LM-
 */
static void prt_shape(int row, int col)
{
    char *shapedesc = "";

    switch (p_ptr->schange) {
    case SHAPE_MOUSE:
	shapedesc = "Mouse     ";
	break;
    case SHAPE_FERRET:
	shapedesc = "Ferret    ";
	break;
    case SHAPE_HOUND:
	shapedesc = "Hound     ";
	break;
    case SHAPE_GAZELLE:
	shapedesc = "Gazelle   ";
	break;
    case SHAPE_LION:
	shapedesc = "Lion      ";
	break;
    case SHAPE_ENT:
	shapedesc = "Ent       ";
	break;
    case SHAPE_BAT:
	shapedesc = "Bat       ";
	break;
    case SHAPE_WEREWOLF:
	shapedesc = "Werewolf  ";
	break;
    case SHAPE_VAMPIRE:
	shapedesc = "Vampire   ";
	break;
    case SHAPE_WYRM:
	shapedesc = "Dragon    ";
	break;
    case SHAPE_BEAR:
	shapedesc = "Bear      ";
	break;
    default:
	shapedesc = "          ";
	break;
    }

    /* Display (or write over) the shapechange with pretty colors. */
    if (mp_ptr->spell_book == TV_DRUID_BOOK)
	c_put_str(TERM_GREEN, shapedesc, row, col);
    else if (mp_ptr->spell_book == TV_NECRO_BOOK)
	c_put_str(TERM_VIOLET, shapedesc, row, col);
    else
	c_put_str(TERM_RED, shapedesc, row, col);

}
Пример #5
0
/*
 * Prints level
 */
static void prt_level(int row, int col)
{
    char tmp[32];

    strnfmt(tmp, sizeof(tmp), "%6d", p_ptr->lev);

    if (p_ptr->lev >= p_ptr->max_lev) {
	put_str("LEVEL ", row, col);
	c_put_str(TERM_L_GREEN, tmp, row, col + 6);
    } else {
	put_str("Level ", row, col);
	c_put_str(TERM_YELLOW, tmp, row, col + 6);
    }
}
Пример #6
0
/*
 * Prints Cur hit points
 */
static void prt_hp(int row, int col)
{
	char cur_hp[32], max_hp[32];
	byte color = player_hp_attr();

	put_str("HP ", row, col);

	strnfmt(max_hp, sizeof(max_hp), "%4d", p_ptr->mhp);
	strnfmt(cur_hp, sizeof(cur_hp), "%4d", p_ptr->chp);
	
	c_put_str(color, cur_hp, row, col + 3);
	c_put_str(TERM_WHITE, "/", row, col + 7);
	c_put_str(TERM_L_GREEN, max_hp, row, col + 8);
}
Пример #7
0
static void print_history_header(void)
{
    char buf[80];

    /* Print the header (character name and title) */
    strnfmt(buf, sizeof(buf), "%s the %s %s", op_ptr->full_name,
	    rp_ptr->name, cp_ptr->name);

    c_put_str(TERM_WHITE, buf, 0, 0);
    c_put_str(TERM_WHITE, "============================================================", 1, 0);
    c_put_str(TERM_WHITE, "CHAR.", 2, 34);
    c_put_str(TERM_WHITE, "|   TURN  |      LOCATION        |LEVEL| EVENT",
	      3, 0);
    c_put_str(TERM_WHITE, "============================================================", 4, 0);
}
Пример #8
0
/*
 * Prints the speed of a character.
 */
static void prt_speed(int row, int col)
{
	int i = p_ptr->state.speed;

	byte attr = TERM_WHITE;
	const char *type = NULL;
	char buf[32] = "";

	/* Hack -- Visually "undo" the Search Mode Slowdown */
	if (p_ptr->searching) i += 10;

	/* Fast */
	if (i > 110)
	{
		attr = TERM_L_GREEN;
		type = "Fast";
	}

	/* Slow */
	else if (i < 110)
	{
		attr = TERM_L_UMBER;
		type = "Slow";
	}

	if (type)
		strnfmt(buf, sizeof(buf), "%s (%+d)", type, (i - 110));

	/* Display the speed */
	c_put_str(attr, format("%-10s", buf), row, col);
}
Пример #9
0
/*
 * Display the quality squelch subtypes.
 */
static void quality_subdisplay(menu_type *menu, int oid, bool cursor, int row, int col, int width)
{
	const char *name = quality_values[oid].name;
	byte attr = (cursor ? TERM_L_BLUE : TERM_WHITE);

	c_put_str(attr, name, row, col);
}
Пример #10
0
bool quest_wolves_finish_hook(char *fmt)
{
	s32b q_idx;

	q_idx = get_next_arg(fmt);

	if (q_idx != QUEST_WOLVES) return FALSE;

	c_put_str(TERM_YELLOW, "Thank you for killing the pack of wolves!", 8, 0);
	c_put_str(TERM_YELLOW, "You can use the hut as your house as a reward.", 9, 0);

	/* Continue the plot */
	*(quest[q_idx].plot) = QUEST_SPIDER;

	return TRUE;
}
Пример #11
0
/*
 * Get the Sex.
 */
static bool get_sex(void)
{
	char query2;
	int loopagain = TRUE;
	
	// Set the default sex info to female
	if (p_ptr->psex == SEX_UNDEFINED)
	{
		p_ptr->psex = SEX_FEMALE;
		sp_ptr = &sex_info[SEX_FEMALE];
	}
	
	while (loopagain == TRUE)
	{
		/* Display the player */
		display_player(0);

		// Highlight the relevant feature
		c_put_str(TERM_YELLOW, sp_ptr->title, 3, 8);
		
		/* Prompt */
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, -1, TERM_SLATE,
					"Enter accept sex");
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, -1, TERM_SLATE,
					"Space change sex");
		
		/* Hack - highlight the key names */
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, - 1, TERM_L_WHITE, "Enter");
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, - 1, TERM_L_WHITE, "Space");
		
		/* Move the cursor */
		Term_gotoxy(0, INSTRUCT_ROW + 1);
				
		/* Query */
		query2 = inkey();
		
		if ((query2 == '\r') || (query2 == '\n'))
		{
			/* got a sex*/
			loopagain = FALSE;
			
			p_ptr->redraw |= (PR_MISC);
		}
		
		else if (query2 == ESCAPE)  return (FALSE);
		
		else if (((query2 == 'Q') || (query2 == 'q')) && (turn == 0)) quit (NULL);

		else
		{
			if (p_ptr->psex == SEX_FEMALE)	p_ptr->psex = SEX_MALE;
			else							p_ptr->psex = SEX_FEMALE;
			
			sp_ptr = &sex_info[p_ptr->psex];
		}
	}
	
	return (TRUE);
}
Пример #12
0
/*
 * Prints current AC
 */
static void prt_ac(int row, int col)
{
	char tmp[32];

	put_str("Cur AC ", row, col);
	strnfmt(tmp, sizeof(tmp), "%5d", p_ptr->state.dis_ac + p_ptr->state.dis_to_a);
	c_put_str(TERM_L_GREEN, tmp, row, col + 7);
}
Пример #13
0
/* A custom "display" function for our menus that simply displays the
   text from our stored data in a different colour if it's currently
   selected. */
static void birthmenu_display(menu_type *menu, int oid, bool cursor,
			      int row, int col, int width)
{
	struct birthmenu_data *data = menu->menu_data;

	byte attr = curs_attrs[CURS_KNOWN][0 != cursor];
	c_put_str(attr, data->items[oid], row, col);
}
Пример #14
0
/*
 * Prints current gold
 */
static void prt_gold(int row, int col)
{
	char tmp[32];

	put_str("AU ", row, col);
	strnfmt(tmp, sizeof(tmp), "%9ld", (long)p_ptr->au);
	c_put_str(TERM_L_GREEN, tmp, row, col + 3);
}
Пример #15
0
/**
 * Display the quality ignore subtypes.
 */
static void quality_subdisplay(struct menu *menu, int oid, bool cursor, int row,
							   int col, int width)
{
	const char *name = quality_values[oid].name;
	byte attr = (cursor ? COLOUR_L_BLUE : COLOUR_WHITE);

	c_put_str(attr, name, row, col);
}
Пример #16
0
/*
 * Display an entry on the sval menu
 */
static void sval_display(menu_type *menu, int oid, bool cursor, int row, int col, int width)
{
	char buf[80];
	const squelch_choice *choice = menu_priv(menu);
	int idx = choice[oid].idx;

	byte attr = (cursor ? TERM_L_BLUE : TERM_WHITE);


	/* Acquire the "name" of object "i" */
	object_kind_name(buf, sizeof(buf), idx, choice[oid].aware);

	/* Print it */
	c_put_str(attr, format("[ ] %s", buf), row, col);
	if ((choice[oid].aware && (k_info[idx].squelch & SQUELCH_IF_AWARE)) ||
	    ((!choice[oid].aware) && (k_info[idx].squelch & SQUELCH_IF_UNAWARE)))
		c_put_str(TERM_L_RED, "*", row, col + 1);
}
Пример #17
0
/*
 * Prints players max/cur spell points
 */
static void prt_sp(int row, int col)
{
	char cur_sp[32], max_sp[32];
	byte color = player_sp_attr();

	/* Do not show mana unless we have some */
	if (!p_ptr->msp) return;

	put_str("SP ", row, col);

	strnfmt(max_sp, sizeof(max_sp), "%4d", p_ptr->msp);
	strnfmt(cur_sp, sizeof(cur_sp), "%4d", p_ptr->csp);

	/* Show mana */
	c_put_str(color, cur_sp, row, col + 3);
	c_put_str(TERM_WHITE, "/", row, col + 7);
	c_put_str(TERM_L_GREEN, max_sp, row, col + 8);
}
Пример #18
0
/*
 * Print recall status.
 */
static size_t prt_recall(int row, int col)
{
    if (p_ptr->word_recall) {
	c_put_str(TERM_WHITE, "Recall", row, col);
	return sizeof "Recall";
    }

    return 0;
}
Пример #19
0
/*
 * Display the objects in a group.
 */
static void display_object(int col, int row, bool cursor, int oid)
{
	object_kind *kind = &k_info[oid];
	const char *inscrip = get_autoinscription(kind);

	char o_name[80];

	/* Choose a color */
	bool aware = (!kind->flavor || kind->aware);
	byte attr = curs_attrs[(int)aware][(int)cursor];

	/* Find graphics bits -- versions of the object_char and object_attr defines */
	bool use_flavour = (kind->flavor) && !(aware && kind->tval == TV_SCROLL);

	byte a = use_flavour ? kind->flavor->x_attr : kind->x_attr;
	byte c = use_flavour ? kind->flavor->x_char : kind->x_char;

	/* Display known artifacts differently */
	if (of_has(kind->flags, OF_INSTA_ART) && artifact_is_known(get_artifact_from_kind(kind)))
		get_artifact_display_name(o_name, sizeof(o_name), get_artifact_from_kind(kind));
	else
 		object_kind_name(o_name, sizeof(o_name), kind, OPT(cheat_know));

	/* If the type is "tried", display that */
	if (kind->tried && !aware)
		my_strcat(o_name, " {tried}", sizeof(o_name));

	/* Display the name */
	c_prt(attr, o_name, row, col);

	/* Show squelch status */
	if ((aware && kind_is_squelched_aware(kind)) ||
		(!aware && kind_is_squelched_unaware(kind)))
		c_put_str(attr, "Yes", row, 46);


	/* Show autoinscription if around */
	if (aware && inscrip)
		c_put_str(TERM_YELLOW, inscrip, row, 55);

	if (tile_height == 1) {
		big_pad(76, row, a, c);
	}
}
Пример #20
0
/**
 * Display an entry on the item menu
 */
void get_curse_display(struct menu *menu, int oid, bool cursor, int row,
					  int col, int width)
{
	struct curse **choice = menu_priv(menu);
	int attr = cursor ? COLOUR_L_BLUE : COLOUR_WHITE;
	char buf[80];
	int power = choice[oid]->power;
	strnfmt(buf, sizeof(buf), "%s (power %d)", choice[oid]->name, power);
	c_put_str(attr, buf, row + oid, col);
}
Пример #21
0
/**
 * Display an entry on the sval menu
 */
static void ignore_sval_menu_display(struct menu *menu, int oid, bool cursor,
									 int row, int col, int width)
{
	char buf[80];
	const ignore_choice *choice = menu_priv(menu);

	struct object_kind *kind = choice[oid].kind;
	bool aware = choice[oid].aware;

	byte attr = curs_attrs[(int)aware][0 != cursor];

	/* Acquire the "name" of object "i" */
	object_kind_name(buf, sizeof(buf), kind, aware);

	/* Print it */
	c_put_str(attr, format("[ ] %s", buf), row, col);
	if ((aware && (kind->ignore & IGNORE_IF_AWARE)) ||
			(!aware && (kind->ignore & IGNORE_IF_UNAWARE)))
		c_put_str(COLOUR_L_RED, "*", row, col + 1);
}
Пример #22
0
/*
 * Display an entry on the sval menu
 */
static void squelch_sval_menu_display(menu_type *menu, int oid, bool cursor,
		int row, int col, int width)
{
	char buf[80];
	const squelch_choice *choice = menu_priv(menu);

	object_kind *kind = choice[oid].kind;
	bool aware = choice[oid].aware;

	byte attr = curs_attrs[(int)aware][0 != cursor];

	/* Acquire the "name" of object "i" */
	object_kind_name(buf, sizeof(buf), kind, aware);

	/* Print it */
	c_put_str(attr, format("[ ] %s", buf), row, col);
	if ((aware && (kind.squelch & SQUELCH_IF_AWARE)) ||
			(!aware && (kind.squelch & SQUELCH_IF_UNAWARE)))
		c_put_str(TERM_L_RED, "*", row, col + 1);
}
Пример #23
0
/**
 * Print the current button list at the specified `row` and `col`umn.
 */
size_t button_print(int row, int col)
{
	int j;

	button_start = col;

	for (j = 0; j < button_num; j++)
		c_put_str(TERM_SLATE, button_mse[j].label, row, col + button_mse[j].left);

	return button_length;
}
Пример #24
0
/**
 * Display an entry on the sval menu
 */
void trap_display(menu_type * menu, int oid, bool cursor, int row, int col,
                  int width)
{
    const u16b *choice = menu_priv(menu);
    int idx = choice[oid];

    byte attr = (cursor ? TERM_L_BLUE : TERM_WHITE);

    /* Print it */
    c_put_str(attr, format("%s", trap_type[idx]), row, col);
}
Пример #25
0
/**
 * Display an entry on the gain specialty menu
 */
void gain_spec_display(menu_type * menu, int oid, bool cursor, int row, int col,
		       int width)
{
    struct spec_menu_data *d = menu_priv(menu);
    int idx = d->specialties[oid];

    byte attr = (cursor ? TERM_L_GREEN : TERM_GREEN);

    /* Print it */
    c_put_str(attr, abilities[idx].name, row, col);

}
Пример #26
0
/*
 * Display an entry in the menu.
 */
static void quality_display(menu_type *menu, int oid, bool cursor, int row, int col, int width)
{
	const char *name = quality_choices[oid].name;

	byte level = squelch_level[oid];
	const char *level_name = quality_values[level].name;

	byte attr = (cursor ? TERM_L_BLUE : TERM_WHITE);


	c_put_str(attr, format("%-20s : %s", name, level_name), row, col);
}
Пример #27
0
/**
 * Display an entry on the item menu
 */
void get_curse_display(struct menu *menu, int oid, bool cursor, int row,
					  int col, int width)
{
	struct curse_menu_data *choice = menu_priv(menu);
	int attr = cursor ? COLOUR_L_BLUE : COLOUR_WHITE;
	char buf[80];
	int power = choice[oid].power;
	char *name = curses[choice[oid].index].name;

	strnfmt(buf, sizeof(buf), "  %s (curse strength %d)", name, power);
	c_put_str(attr, buf, row, col);
}
Пример #28
0
/**
 * Display an entry on the sval menu
 */
static void ego_display(struct menu * menu, int oid, bool cursor, int row,
						int col, int width)
{
	char buf[80] = "";
	struct ego_desc *choice = (struct ego_desc *) menu->menu_data;
	bool ignored = ego_is_ignored(choice[oid].e_idx, choice[oid].itype);

	byte attr = (cursor ? COLOUR_L_BLUE : COLOUR_WHITE);
	byte sq_attr = (ignored ? COLOUR_L_RED : COLOUR_L_GREEN);

	/* Acquire the "name" of object "i" */
	(void) ego_item_name(buf, sizeof(buf), &choice[oid]);

	/* Print it */
	c_put_str(attr, format("%s", buf), row, col);

	/* Show ignore mark, if any */
	if (ignored)
		c_put_str(COLOUR_L_RED, "*", row, col + 1);

	/* Show the stripped ego-item name using another colour */
	c_put_str(sq_attr, choice[oid].short_name, row, col + strlen(buf));
}
Пример #29
0
/*
 * Print location
 */
static size_t prt_depth(int row, int col)
{
    char depths[32];

    s16b attr = TERM_L_BLUE;
    int region, level;

    region = stage_map[p_ptr->stage][LOCALITY];

    level = stage_map[p_ptr->stage][DEPTH];

    if (level)
	strnfmt(depths, sizeof(depths), "%s %d", locality_name[region],
		level);
    else
	strnfmt(depths, sizeof(depths), "%s", locality_name[region]);


    /* Get color of level based on feeling -JSV- */
    if ((p_ptr->depth) && (do_feeling)) {
	if (p_ptr->themed_level)
	    attr = TERM_BLUE;
	else if (feeling == 1)
	    attr = TERM_VIOLET;
	else if (feeling == 2)
	    attr = TERM_RED;
	else if (feeling == 3)
	    attr = TERM_L_RED;
	else if (feeling == 4)
	    attr = TERM_ORANGE;
	else if (feeling == 5)
	    attr = TERM_ORANGE;
	else if (feeling == 6)
	    attr = TERM_YELLOW;
	else if (feeling == 7)
	    attr = TERM_YELLOW;
	else if (feeling == 8)
	    attr = TERM_WHITE;
	else if (feeling == 9)
	    attr = TERM_WHITE;
	else if (feeling == 10)
	    attr = TERM_L_WHITE;
    }

    /* Right-Adjust the "depth", and clear old values */
    c_put_str(attr, depths, row, col);

    return sizeof(depths);
}
Пример #30
0
static void display_group_member(menu_type * menu, int oid, bool cursor,
								 int row, int col, int wid)
{
	const member_funcs *o_funcs = menu->menu_data;
	byte attr = curs_attrs[CURS_KNOWN][cursor == oid];

	(void) wid;

	/* Print the interesting part */
	o_funcs->display_member(col, row, cursor, oid);

#if 0							/* Debugging code */
	c_put_str(attr, format("%d", oid), row, 60);
#endif

	/* Do visual mode */
	if (o_funcs->is_visual && o_funcs->xattr) {
		wchar_t c = *o_funcs->xchar(oid);
		byte a = *o_funcs->xattr(oid);

		c_put_str(attr, format((c & 0x80) ? "%02x/%02x" : "%02x/%d", a, c),
				  row, 60);
	}
}