Angband
Data Structures | Macros | Functions | Variables
ui-player.c File Reference

character screens and dumps More...

#include "angband.h"
#include "buildid.h"
#include "game-world.h"
#include "init.h"
#include "obj-curse.h"
#include "obj-desc.h"
#include "obj-gear.h"
#include "obj-info.h"
#include "obj-knowledge.h"
#include "obj-util.h"
#include "player.h"
#include "player-calcs.h"
#include "player-timed.h"
#include "player-util.h"
#include "store.h"
#include "ui-display.h"
#include "ui-history.h"
#include "ui-input.h"
#include "ui-menu.h"
#include "ui-object.h"
#include "ui-output.h"
#include "ui-player.h"

Data Structures

struct  panel_line
 

Panel utilities

More...
 
struct  panel
 Panel holder type. More...
 
struct  player_flag_record
 

Macros

#define RES_ROWS   9
 List of resistances and abilities to display. More...
 
#define BOUND(x, min, max)   MIN(max, MAX(min, x))
 
#define INFO_SCREENS   2 /* Number of screens in character info mode */
 

Functions

static struct panelpanel_allocate (int n)
 Allocate some panel lines. More...
 
static void panel_free (struct panel *p)
 Free up panel lines. More...
 
static void panel_line (struct panel *p, byte attr, const char *label, const char *fmt,...)
 Add a new line to the panel. More...
 
static void panel_space (struct panel *p)
 Add a spacer line in a panel. More...
 
static const char * likert (int x, int y, byte *attr)
 Returns a "rating" of x depending on y, and sets "attr" to the corresponding "attribute". More...
 
static void display_player_equippy (int y, int x)
 Equippy chars. More...
 
static void display_resistance_panel (const struct player_flag_record *rec, size_t size, const region *bounds)
 
static void display_player_flag_info (void)
 
void display_player_stat_info (void)
 Special display, part 2b. More...
 
static void display_player_sust_info (void)
 Special display, part 2c. More...
 
static void display_panel (const struct panel *p, bool left_adj, const region *bounds)
 
static const char * show_title (void)
 
static const char * show_adv_exp (void)
 
static const char * show_depth (void)
 
static const char * show_speed (void)
 
static byte max_color (int val, int max)
 
static struct panelget_panel_topleft (void)
 
static struct panelget_panel_midleft (void)
 
static struct panelget_panel_combat (void)
 
static struct panelget_panel_skills (void)
 
static struct panelget_panel_misc (void)
 
void display_player_xtra_info (void)
 
void display_player (int mode)
 Display the character on the screen (two different modes) More...
 
void write_character_dump (ang_file *fff)
 Write a character dump. More...
 
bool dump_save (const char *path)
 Save the lore to a file in the user directory. More...
 
void do_cmd_change_name (void)
 Hack – change name. More...
 

Variables

static const struct player_flag_record player_flag_table [RES_ROWS *4]
 
static const byte colour_table []
 Colours for table items. More...
 
struct {
   region   bounds
 
   bool   align_left
 
   struct panel *(*   panel )(void)
 
panels []
 Panels for main character screen. More...
 

Detailed Description

character screens and dumps

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Macro Definition Documentation

◆ BOUND

#define BOUND (   x,
  min,
  max 
)    MIN(max, MAX(min, x))

Referenced by get_panel_skills().

◆ INFO_SCREENS

#define INFO_SCREENS   2 /* Number of screens in character info mode */

Referenced by do_cmd_change_name().

◆ RES_ROWS

#define RES_ROWS   9

List of resistances and abilities to display.

Referenced by display_player_flag_info().

Function Documentation

◆ display_panel()

static void display_panel ( const struct panel p,
bool  left_adj,
const region bounds 
)
static

◆ display_player()

void display_player ( int  mode)

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

References align_left, angband_term, bounds, clear_from(), display_panel(), display_player_flag_info(), display_player_stat_info(), display_player_sust_info(), display_player_xtra_info(), p, panel_free(), panels, player_upkeep::playing, Term, and player::upkeep.

Referenced by death_info(), do_cmd_change_name(), roller_command(), textui_do_birth(), update_player0_subwindow(), update_player1_subwindow(), and write_character_dump().

◆ display_player_equippy()

static void display_player_equippy ( int  y,
int  x 
)
static

◆ display_player_flag_info()

static void display_player_flag_info ( void  )
static

◆ display_player_stat_info()

void display_player_stat_info ( void  )

◆ display_player_sust_info()

static void display_player_sust_info ( void  )
static

Special display, part 2c.

How to print out the modifications and sustains. Positive mods with no sustain will be light green. Positive mods with a sustain will be dark green. Sustains (with no modification) will be a dark green 's'. Negative mods (from a curse) will be red. Huge mods (>9), like from MICoMorgoth, will be a '*' No mod, no sustain, will be a slate '.'

References player::body, c_put_str(), COLOUR_GREEN, COLOUR_L_GREEN, COLOUR_RED, COLOUR_SLATE, COLOUR_WHITE, player_body::count, display_player_equippy(), i, I2D, object::modifiers, OBJ_MOD_MIN_STAT, object_flag_is_known(), object_flags_known(), of_has, OF_SIZE, player_flags(), row, slot_object(), STAT_MAX, sustain_flag(), and Term_putch().

Referenced by display_player().

◆ display_player_xtra_info()

void display_player_xtra_info ( void  )

◆ display_resistance_panel()

static void display_resistance_panel ( const struct player_flag_record rec,
size_t  size,
const region bounds 
)
static

◆ do_cmd_change_name()

void do_cmd_change_name ( void  )

◆ dump_save()

bool dump_save ( const char *  path)

Save the lore to a file in the user directory.

Parameters
pathis the path to the filename
Returns
true on success, false otherwise.

References msg, text_lines_to_file(), and write_character_dump().

Referenced by death_file(), and do_cmd_change_name().

◆ get_panel_combat()

static struct panel* get_panel_combat ( void  )
static

◆ get_panel_midleft()

static struct panel* get_panel_midleft ( void  )
static

◆ get_panel_misc()

static struct panel* get_panel_misc ( void  )
static

◆ get_panel_skills()

static struct panel* get_panel_skills ( void  )
static

◆ get_panel_topleft()

static struct panel* get_panel_topleft ( void  )
static

◆ likert()

static const char* likert ( int  x,
int  y,
byte attr 
)
static

Returns a "rating" of x depending on y, and sets "attr" to the corresponding "attribute".

References COLOUR_L_GREEN, COLOUR_RED, and COLOUR_YELLOW.

Referenced by get_panel_skills().

◆ max_color()

static byte max_color ( int  val,
int  max 
)
static

References COLOUR_L_GREEN, and COLOUR_YELLOW.

Referenced by get_panel_midleft().

◆ panel_allocate()

static struct panel* panel_allocate ( int  n)
static

◆ panel_free()

static void panel_free ( struct panel p)
static

Free up panel lines.

References panel::lines, and mem_free().

Referenced by display_player(), and display_player_xtra_info().

◆ panel_line()

static void panel_line ( struct panel p,
byte  attr,
const char *  label,
const char *  fmt,
  ... 
)
static

◆ panel_space()

static void panel_space ( struct panel p)
static

Add a spacer line in a panel.

References panel::len, and panel::max.

Referenced by get_panel_combat(), and get_panel_midleft().

◆ show_adv_exp()

static const char* show_adv_exp ( void  )
static

◆ show_depth()

static const char* show_depth ( void  )
static

References buffer, player::max_depth, and strnfmt().

Referenced by get_panel_midleft().

◆ show_speed()

static const char* show_speed ( void  )
static

◆ show_title()

static const char* show_title ( void  )
static

◆ write_character_dump()

void write_character_dump ( ang_file fff)

Variable Documentation

◆ align_left

bool align_left

◆ bounds

region bounds

◆ colour_table

const byte colour_table[]
static
Initial value:
=
{
}
#define COLOUR_YELLOW
Definition: z-color.h:34
#define COLOUR_RED
Definition: z-color.h:27
#define COLOUR_L_RED
Definition: z-color.h:35
#define COLOUR_L_BLUE
Definition: z-color.h:37
#define COLOUR_L_GREEN
Definition: z-color.h:36
#define COLOUR_ORANGE
Definition: z-color.h:26
#define COLOUR_GREEN
Definition: z-color.h:28

Colours for table items.

Referenced by get_panel_skills().

◆ panel

struct panel*(* panel) (void)

Referenced by display_knowledge().

◆ panels

const { ... } panels[]
Initial value:
=
{
{ { 1, 1, 40, 7 }, true, get_panel_topleft },
{ { 21, 1, 18, 3 }, false, get_panel_misc },
{ { 1, 9, 24, 9 }, false, get_panel_midleft },
{ { 29, 9, 19, 9 }, false, get_panel_combat },
{ { 52, 9, 20, 8 }, false, get_panel_skills },
}
static struct panel * get_panel_midleft(void)
Definition: ui-player.c:761
static struct panel * get_panel_topleft(void)
Definition: ui-player.c:748
static struct panel * get_panel_skills(void)
Definition: ui-player.c:824
static struct panel * get_panel_misc(void)
Definition: ui-player.c:872
static struct panel * get_panel_combat(void)
Definition: ui-player.c:782

Panels for main character screen.

Referenced by display_player(), and display_player_xtra_info().

◆ player_flag_table

const struct player_flag_record player_flag_table[RES_ROWS *4]
static