Esempio n. 1
0
/**
 * Display the character on the screen (two different modes)
 *
 * The top two lines, and the bottom line (or two) are left blank.
 *
 * Mode 0 = standard display with skills/history
 * Mode 1 = special display with equipment flags
 */
void display_player(int mode)
{
	/* Erase screen */
	clear_from(0);

	/* When not playing, do not display in subwindows */
	if (Term != angband_term[0] && !player->upkeep->playing) return;

	/* Stat info */
	display_player_stat_info();

	if (mode) {
		struct panel *p = panels[0].panel();
		display_panel(p, panels[0].align_left, &panels[0].bounds);
		panel_free(p);

		/* Stat/Sustain flags */
		display_player_sust_info();

		/* Other flags */
		display_player_flag_info();
	} else {
		/* Extra info */
		display_player_xtra_info();
	}
}
Esempio n. 2
0
/*
 * Display the character on the screen (two different modes)
 *
 * The top two lines, and the bottom line (or two) are left blank.
 *
 * Mode 0 = standard display with skills/history
 * Mode 1 = special display with equipment flags
 */
void display_player(int mode)
{
	/* Erase screen */
	clear_from(0);


	/* Stat info */
	display_player_stat_info();

	if (mode)
	{
		data_panel data[MAX_PANEL];
		int rows = get_panel(1, data, N_ELEMENTS(data));

		display_panel(data, rows, 1, &boundaries[1]);

		/* Stat/Sustain flags */
		display_player_sust_info();

		/* Other flags */
		display_player_flag_info();
	}

	/* Standard */
	else
	{
		/* Extra info */
		display_player_xtra_info();
	}
}
Esempio n. 3
0
static void point_based_start(void)
{
	const char *prompt = "[up/down to move, left/right to modify, 'r' to reset, 'Enter' to accept]";

	/* Clear */
	Term_clear();

	/* Display the player */
	display_player_xtra_info();
	display_player_stat_info();

	prt(prompt, Term->hgt - 1, Term->wid / 2 - strlen(prompt) / 2);

	/* Register handlers for various events - cheat a bit because we redraw
	   the lot at once rather than each bit at a time. */
	event_add_handler(EVENT_BIRTHPOINTS, point_based_points, NULL);	
	event_add_handler(EVENT_STATS, point_based_stats, NULL);	
	event_add_handler(EVENT_GOLD, point_based_misc, NULL);	
}
Esempio n. 4
0
/* This is called whenever any of the other miscellaneous stat-dependent things
   changed.  We are hooked into changes in the amount of gold in this case,
   but redisplay everything because it's easier. */
static void point_based_misc(game_event_type type, game_event_data *data, void *user)
{
	display_player_xtra_info();
}
Esempio n. 5
0
/*
 * Get the Age, Height and Weight.
 */
static bool get_ahw(void)
{
	char prompt[50];
	char line[70];
	char query2;
	int loopagain = TRUE;

	// hack to see whether we are opening an old player file
	bool roll_ahw = !p_ptr->age;
	
	//put_str("(a)ccept age/height/weight, (r)eroll, (m)anually enter ", 0, 0);
	
	while (loopagain == TRUE)
	{
		if (roll_ahw)
		{
			/*get the random age/height/weight, display for approval. */
			get_ahw_aux();
		}
		else
		{
			roll_ahw = TRUE;
		}

		/* Display the player */
		display_player(0);

		// Highlight relevant info
		display_player_xtra_info(1);

		/* Prompt */
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, -1, TERM_SLATE,
					"Enter accept age/height/weight");
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, -1, TERM_SLATE,
					"Space reroll");
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 3, -1, TERM_SLATE,
					"    m manually enter");
		
		/* 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");
		Term_putstr(QUESTION_COL + 4, INSTRUCT_ROW + 3, - 1, TERM_L_WHITE, "m");
		
		/* Move the cursor */
		Term_gotoxy(0, INSTRUCT_ROW + 1);

		/* Query */
		query2 = inkey();

		if ((query2 == '\r') || (query2 == '\n'))
		{
			/* got ahw*/
			loopagain = FALSE;

			p_ptr->redraw |= (PR_MISC);
		}

		else if ((query2 == 'm') || (query2 == 'M'))
		{
			/* don't want random stats */
			int age = 0;
			int height = 0;
			int weight = 0;
			int age_l, age_h, height_l, height_h, weight_l, weight_h;

			age_l = 10;
			age_h = 4865;
		
			if (p_ptr->psex == SEX_MALE)
			{
				height_l = rp_ptr->m_b_ht - 5 * (rp_ptr->m_m_ht);
				height_h = rp_ptr->m_b_ht + 5 * (rp_ptr->m_m_ht);
				weight_l = rp_ptr->m_b_wt / 3;
				weight_h = rp_ptr->m_b_wt * 2;
			}
			else
			{
				height_l = rp_ptr->f_b_ht - 5 * (rp_ptr->f_m_ht);
				height_h = rp_ptr->f_b_ht + 5 * (rp_ptr->f_m_ht);
				weight_l = rp_ptr->f_b_wt / 3;
				weight_h = rp_ptr->f_b_wt * 2;
			}
			
			// clear line
			line[0] = '\0';
			
			while ((age < age_l) || (age > age_h))
			{
				sprintf(prompt, "Enter age (%d-%d): ", age_l, age_h);
				if (!term_get_string(prompt, line, sizeof(line))) return (FALSE);
				age = atoi(line);
				p_ptr->age = age;
			}
			
			/* Display the player */
			p_ptr->redraw |= (PR_MISC);
			display_player(0);
				
			// clear line
			line[0] = '\0';

			while ((height < height_l) || (height > height_h))
			{
				sprintf(prompt, "Enter height in inches (%d-%d): ", height_l, height_h);
				if (!term_get_string(prompt, line, sizeof(line))) return (FALSE);
				height = atoi(line);
				p_ptr->ht = height;
			}
			
			/* Display the player */
			p_ptr->redraw |= (PR_MISC);
			display_player(0);
			
			// clear line
			line[0] = '\0';

			while ((weight < weight_l) || (weight > weight_h))
			{
				sprintf(prompt, "Enter weight in pounds (%d-%d): ", weight_l, weight_h);
				if (!term_get_string(prompt, line, sizeof(line))) return (FALSE);
				weight = atoi(line);
				p_ptr->wt = weight;
			}
			
			/* Display the player */
			p_ptr->redraw |= (PR_MISC);
			display_player(0);

			// confirm the choices
			if (!get_ahw()) return (FALSE);

			loopagain = FALSE;
		}

		else if (query2 == ESCAPE)  return (FALSE);

		else if (((query2 == 'Q') || (query2 == 'q')) && (turn == 0)) quit (NULL);
	}
	
	return (TRUE);
}
Esempio n. 6
0
/*
 * Get the racial history, and social class, using the "history charts".
 */
static bool get_history(void)
{
	int i;
	char line[70];
	char query2;
	int loopagain = TRUE;
	
	// hack to see whether we are opening an old player file
	bool roll_history = !(p_ptr->history[0]);
		
	while (loopagain == TRUE)
	{
		if (roll_history)
		{
			/*get the random history, display for approval. */
			get_history_aux();
		}
		else
		{
			roll_history = TRUE;
		}

		/* Display the player */
		display_player(0);

		// Highlight relevant info
		display_player_xtra_info(2);
		
		/* Prompt */
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 1, -1, TERM_SLATE,
					"Enter accept history");
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 2, -1, TERM_SLATE,
					"Space reroll history");
		Term_putstr(QUESTION_COL, INSTRUCT_ROW + 3, -1, TERM_SLATE,
					"    m manually enter history");
		
		/* 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");
		Term_putstr(QUESTION_COL + 4, INSTRUCT_ROW + 3, - 1, TERM_L_WHITE, "m");

		/* Move the cursor */
		Term_gotoxy(0, INSTRUCT_ROW + 1);
		
		/* Query */
		query2 = inkey();

		if ((query2 == '\r') || (query2 == '\n'))
		{
			/* got a history*/
			loopagain = FALSE;

			p_ptr->redraw |= (PR_MISC);
		}

		else if ((query2 == 'm') || (query2 == 'M'))
		{
			/* don't want a random history */
			
			/* Clear the previous history strings */
			p_ptr->history[0] = '\0';

			/* Display the player */
			display_player(0);

			for (i = 1; i <= 3; i++)
			{
				// clear line
				line[0] = '\0';
								
				Term_gotoxy(1, 15+i);
				
				/* Prompt for a new history */
				if (askfor_aux(line, sizeof(line)))
				{

					/* Get the textual history */
					my_strcat(p_ptr->history, line, sizeof(p_ptr->history));

					/* Add a space */
					my_strcat(p_ptr->history, "\n", sizeof(p_ptr->history));
					
					p_ptr->redraw |= (PR_MISC);

					/* Display the player */
					display_player(0);
				}
				else
				{
					return (FALSE);
				}
			}

			// confirm the choices
			if (!get_history()) return (FALSE);

			loopagain = FALSE;
		}
		
		else if (query2 == ESCAPE)  return (FALSE);

		else if (((query2 == 'Q') || (query2 == 'q')) && (turn == 0)) quit (NULL);

	}

	return (TRUE);
}