Пример #1
0
/**
 * Warriors will eventually learn to pseudo-probe monsters.  If they use 
 * the browse command, give ability information. -LM-
 */
static void warrior_probe_desc(void)
{
	/* Save screen */
	screen_save();

	/* Erase the screen */
	Term_clear();

	/* Set the indent */
	text_out_indent = 5;

	/* Title in light blue. */
	text_out_to_screen(TERM_L_BLUE, "Warrior Pseudo-Probing Ability:");
	text_out_to_screen(TERM_WHITE, "\n\n");

	/* Print out information text. */
	text_out_to_screen(TERM_WHITE,
					   "Warriors learn to probe monsters at level 35.  This costs nothing except a full turn.  When you reach this level, type 'm', and target the monster you would like to learn more about.  This reveals the monster's race, approximate HPs, and basic resistances.  Be warned:  the information given is not always complete...");
	text_out_to_screen(TERM_WHITE, "\n\n\n");

	/* The "exit" sign. */
	text_out_to_screen(TERM_WHITE, "    (Press any key to continue.)\n");

	/* Wait for it. */
	(void) inkey_ex();

	/* Load screen */
	screen_load();
}
Пример #2
0
/*
 * Display the text from a note on the screen.
 */
void note_info_screen(const object_type *o_ptr)
{	
	/* Redirect output to the screen */
	text_out_hook = text_out_to_screen;
	
	/* Save the screen */
	screen_save();
			
	/* Indent output by 14 characters, and wrap at column 60 */
	text_out_wrap = 60;
	text_out_indent = 14;
	
	/* Note intro */
	Term_gotoxy(text_out_indent, 0);
	text_out_c(TERM_L_WHITE+TERM_SHADE, "The note here reads:\n\n");

	/* Note text */
	Term_gotoxy(text_out_indent, 2);
	text_out_to_screen(TERM_WHITE, k_text + k_info[o_ptr->k_idx].text);

	/* Note outro */
	text_out_c(TERM_L_WHITE+TERM_SHADE, "\n\n(press any key)\n");
	
	/* Reset text_out() vars */
	text_out_wrap = 0;
	text_out_indent = 0;
	
	/* Wait for input */
	(void)inkey();
	
	/* Load the screen */
	screen_load();
	
	return;
}
Пример #3
0
/*
 * Display quality squelch menu.
 */
static void quality_menu(void *unused, const char *also_unused)
{
	menu_type menu;
	menu_iter menu_f = { NULL, NULL, quality_display, quality_action };
	region area = { 1, 5, -1, -1 };

	/* Save screen */
	screen_save();
	clear_from(0);

	/* Help text */
	prt("Quality squelch menu", 0, 0);

	Term_gotoxy(1, 1);
	text_out_to_screen(TERM_L_RED, "Use the movement keys to navigate, and Enter to change settings.");

	/* Set up the menu */
	menu_init(&menu, MN_SKIN_SCROLL, &menu_f);
	menu_setpriv(&menu, TYPE_MAX, quality_values);
	menu_layout(&menu, &area);

	/* Select an entry */
	menu_select(&menu, 0);

	/* Load screen */
	screen_load();
	return;
}
Пример #4
0
void display_player_xtra_info(void)
{
	int i;
	int panels [] = { 1, 2, 3, 4};
	bool left_adj [] = { 1, 0, 0, 0, 0 };
	data_panel data[MAX_PANEL];

	for (i = 0; i < (int)N_ELEMENTS(panels); i++)
	{
		int oid = panels[i];
		int rows = get_panel(oid, data, N_ELEMENTS(data));

		/* Hack:  Don't show 'Level' in the name, class ...  panel */
		if (oid == 1) rows -= 1;

		display_panel(data, rows, left_adj[i], &boundaries[oid]);
	}

	/* Indent output by 1 character, and wrap at column 72 */
	text_out_wrap = 72;
	text_out_indent = 1;

	/* History */
	Term_gotoxy(text_out_indent, 19);
	text_out_to_screen(TERM_WHITE, p_ptr->history);

	/* Reset text_out() vars */
	text_out_wrap = 0;
	text_out_indent = 0;

	return;
}
Пример #5
0
/**
 * Show spell long description when browsing
 */
static void  gain_spec_menu_browser(int oid, void *data, const region *loc)
{
    struct spec_menu_data *d = data;
    
    /* Redirect output to the screen */
    text_out_hook = text_out_to_screen;
    text_out_wrap = 0;
    text_out_indent = loc->col - 1;
    text_out_pad = 1;
    
    
    clear_from(loc->row + loc->page_rows);
    Term_gotoxy(loc->col, loc->row + loc->page_rows);
    text_out_to_screen(TERM_DEEP_L_BLUE, (char *) abilities[d->specialties[oid]].desc);
    
    /* XXX */
    text_out_pad = 0;
    text_out_indent = 0;
}
Пример #6
0
void display_player_xtra_info(void)
{
	size_t i;
	for (i = 0; i < N_ELEMENTS(panels); i++) {
		struct panel *p = panels[i].panel();
		display_panel(p, panels[i].align_left, &panels[i].bounds);
		panel_free(p);
	}

	/* Indent output by 1 character, and wrap at column 72 */
	text_out_wrap = 72;
	text_out_indent = 1;

	/* History */
	Term_gotoxy(text_out_indent, 19);
	text_out_to_screen(COLOUR_WHITE, player->history);

	/* Reset text_out() vars */
	text_out_wrap = 0;
	text_out_indent = 0;

	return;
}
Пример #7
0
/*
 * Generic "get choice from menu" function
 */
static int get_player_choice(birth_menu *choices, int num, int def, int col, int wid, void (*hook)(birth_menu))
{
	int top = 0, next;
	int i, dir;
	char c;
	char buf[300];
	bool done = FALSE;
	int hgt;
	byte attr;
	int cur = (def) ? def : 0; 

	/* Autoselect if able */
	//if (num == 1) done = TRUE;

	/* Clear */
	for (i = TABLE_ROW; i < DESCRIPTION_ROW + 4; i++)
	{
		/* Clear */
		Term_erase(col, i, Term->wid - wid);
	}

	/* Choose */
	while (TRUE)
	{
		hgt = Term->hgt - TABLE_ROW - 1;

		/* Redraw the list */
		for (i = 0; ((i + top < num) && (i <= hgt)); i++)
		{
			if (i + top < 26)
			{
				strnfmt(buf, sizeof(buf), "%c) %s", I2A(i + top), choices[i + top].name);
			}
			else
			{
				/* ToDo: Fix the ASCII dependency */
				strnfmt(buf, sizeof(buf), "%c) %s", 'A' + (i + top - 26), choices[i + top].name);
			}

			/* Clear */
			Term_erase(col, i + TABLE_ROW, wid);

			/* Display */
			if (i == (cur - top))
			{
				/* Highlight the current selection */
				if (choices[i + top].ghost) attr = TERM_BLUE;
				else attr = TERM_L_BLUE;
			}
			else
			{
				if (choices[i + top].ghost) attr = TERM_SLATE;
				else attr = TERM_WHITE;
			}

			Term_putstr(col, i + TABLE_ROW, wid, attr, buf);
		}

		Term_erase(0, DESCRIPTION_ROW + 0, 255);
		Term_erase(0, DESCRIPTION_ROW + 1, 255);
		Term_erase(0, DESCRIPTION_ROW + 2, 255);
		Term_erase(0, DESCRIPTION_ROW + 3, 255);
		Term_erase(0, DESCRIPTION_ROW + 4, 255);
		
		if (choices[cur+top].text != NULL)
		{

			/* Indent output by 2 character, and wrap at column 70 */
			text_out_wrap = 70;
			text_out_indent = 2;

			/* History */
			Term_gotoxy(text_out_indent, DESCRIPTION_ROW);
			text_out_to_screen(TERM_L_WHITE, choices[cur+top].text);

			/* Reset text_out() vars */
			text_out_wrap = 0;
			text_out_indent = 0;
		}
		
		else
		{
			/* Extra info */
//			Term_putstr(QUESTION_COL, DESCRIPTION_ROW, -1, TERM_L_WHITE,
//						"Your sex has no gameplay effect.");
			
		}

		if (done) return (cur);

		/* Display auxiliary information if any is available. */
		if (hook) hook(choices[cur]);


		/* Move the cursor */
		put_str("", TABLE_ROW + cur - top, col);

		hide_cursor = TRUE;
		c = inkey();
		hide_cursor = FALSE;

		/* Exit the game */
		if ((c == 'Q') || (c == 'q'))	quit(NULL);

		/* Hack - go back */
		if ((c == ESCAPE)|| (c == '4')) return (INVALID_CHOICE);

		/* Make a choice */
		if ((c == '\n') || (c == '\r') || (c == '6')) return (cur);

		/* Random choice */
		if (c == '*')
		{
			/* Ensure legal choice */
			do { cur = rand_int(num); } while (choices[cur].ghost);

			/* Done */
			done = TRUE;
		}

		/* Alphabetic choice */
		else if (isalpha(c))
		{

			/* Options */
			if ((c == 'O') || (c == 'o'))
			{
				do_cmd_options();
			}

			else
			{
				int choice;

				if (islower(c)) choice = A2I(c);
				else choice = c - 'A' + 26;
				
				/* Validate input */
				if ((choice > -1) && (choice < num) && !(choices[choice].ghost))
				{
					cur = choice;
					
					/* Done */
					done = TRUE;
				}
				else if (choices[choice].ghost)
				{
					bell("Your race cannot choose that house.");
				}
				else
				{
					bell("Illegal response to question!");
				}
			}
		}

		/* Move */
		else if (isdigit(c))
		{
			/* Get a direction from the key */
			dir = target_dir(c);

			/* Going up? */
			if (dir == 8)
			{
				next = -1;
				for (i = 0; i < cur; i++)
				{
					if (!(choices[i].ghost))
					{
						next = i;
					}
				}
				
				/* Move selection */
				if (next != -1) cur = next;
				/* if (cur != 0) cur--; */

				/* Scroll up */
				if ((top > 0) && ((cur - top) < 4))	top--;		
			}

			/* Going down? */
			if (dir == 2)
			{
				next = -1;
				for (i = num - 1; i > cur; i--)
				{
					if (!(choices[i].ghost))
					{
						next = i;
					}
				}
				
				/* Move selection */
				if (next != -1) cur = next;
				/* if (cur != (num - 1)) cur++; */

				/* Scroll down */
				if ((top + hgt < (num - 1)) && ((top + hgt - cur) < 4)) top++;
			}
		}

		/* Invalid input */
		else bell("Illegal response to question!");

		/* If choice is off screen, move it to the top */
		if ((cur < top) || (cur > top + hgt)) top = cur;
	}

	return (INVALID_CHOICE);
}
Пример #8
0
/*
 * Describe immunities granted by an object.
 */
static bool describe_immune(textblock *tb, const object_type *o_ptr, 
			    oinfo_detail_t mode)
{
    int res = 0, imm = 0, vul = 0, j;

    bool full = mode & OINFO_FULL;
    bool dummy = mode & OINFO_DUMMY;
    bool terse = mode & OINFO_TERSE;
    bool prev = FALSE;

    /* Check for resists and vulnerabilities */
    for (j = 0; j < MAX_P_RES; j++) {
	if (!if_has(o_ptr->id_other, OBJECT_ID_BASE_RESIST + j)  && !full) 
	    continue;
	if (o_ptr->percent_res[j] == RES_BOOST_IMMUNE) 
	    imm++;
	else if (o_ptr->percent_res[j] < RES_LEVEL_BASE) {
	    res++;
	}
	else if (o_ptr->percent_res[j] > RES_LEVEL_BASE)
	    vul++;
    }

    /* Immunities */
    if (imm) {
	textblock_append(tb, "Provides ");
	textblock_append_c(tb, TERM_BLUE, "immunity ");
	textblock_append(tb, "to ");

	/* Loop for number of attributes in this group. */
	for (j = 0; j < 4; j++) {
	    if (o_ptr->percent_res[j] > RES_BOOST_IMMUNE)
		continue;
	    if (!if_has(o_ptr->id_other, OBJECT_ID_BASE_RESIST + j)  && !full)
		continue;

	    /* List the attribute description, in its proper place. */
	    if (terse)
		textblock_append(tb, resists[j].name);
	    else
		textblock_append_c(tb, resists[j].attr, resists[j].name);
	    if (imm >= (terse ? 2 : 3))
		textblock_append(tb, ", ");
	    if ((imm == 2) && !terse)
		textblock_append(tb, " and ");
	    imm--;
	}

	/* End sentence. */
	text_out_to_screen(TERM_WHITE, ". ");
	prev = TRUE;
    }

    /* Resistances */
    if (res) {
	textblock_append(tb, "Provides ");
	textblock_append_c(tb, TERM_L_BLUE, "resistance ");
	textblock_append(tb, "to ");

	/* Loop for number of attributes in this group. */
	for (j = 0; j < MAX_P_RES; j++) {
	    if (o_ptr->percent_res[j] >= RES_LEVEL_BASE)
		continue;
	    if (o_ptr->percent_res[j] == RES_BOOST_IMMUNE)
		continue;
	    if (!if_has(o_ptr->id_other, OBJECT_ID_BASE_RESIST + j)  && !full)
		continue;

	    /* List the attribute description, in its proper place. */
	    if (terse)
		textblock_append(tb, resists[j].name);
	    else
		textblock_append_c(tb, resists[j].attr, resists[j].name);
	    textblock_append(tb, "(");
	    if (dummy) textblock_append(tb, "about ");
	    textblock_append(tb, "%d%%)", RES_LEVEL_BASE - o_ptr->percent_res[j]);
	    if (res >= (terse ? 2 : 3))
		textblock_append(tb, ", ");
	    if ((res == 2) && !terse)
		textblock_append(tb, " and ");
	    res--;
	}

	/* End sentence. */
	textblock_append(tb, ". ");
	prev = TRUE;
    }

    /* Vulnerabilities */
    if (vul) {
	textblock_append(tb, "Makes you ");
	textblock_append_c(tb, TERM_ORANGE, "vulnerable ");
	textblock_append(tb, "to ");

	/* Loop for number of attributes in this group. */
	for (j = 0; j < MAX_P_RES; j++) {
	    if (o_ptr->percent_res[j] <= RES_LEVEL_BASE)
		continue;
	    if (!if_has(o_ptr->id_other, OBJECT_ID_BASE_RESIST + j))
		continue;

	    /* List the attribute description, in its proper place. */
	    if (terse)
		textblock_append(tb, resists[j].name);
	    else
		textblock_append_c(tb, resists[j].attr, resists[j].name);
	    textblock_append(tb, "(");
	    if (dummy) textblock_append(tb, "about ");
	    textblock_append(tb, "%d%%)", o_ptr->percent_res[j] - RES_LEVEL_BASE);
	    if (vul >= (terse ? 2 : 3))
		textblock_append(tb, ", ");
	    if ((vul == 2) && !terse)
		textblock_append(tb, " and ");
	    vul--;
	}

	/* End sentence. */
	text_out_to_screen(TERM_WHITE, ". ");
	prev = TRUE;
    }

    return prev;
}