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-entry.h"
#include "ui-entry-renderers.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  char_sheet_resist
 Cache the layout of the character sheet, currently only for the resistance panel, since it is no longer hardwired. More...
 
struct  char_sheet_config
 

Macros

#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 void display_resistance_panel (int ipart, struct char_sheet_config *config)
 
static bool have_valid_char_sheet_config (void)
 
static void release_char_sheet_config (void)
 
static bool check_for_two_categories (const struct ui_entry *entry, void *closure)
 
static void configure_char_sheet (void)
 
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_player_flag_info (void)
 
void display_player_stat_info (void)
 Special display, part 2b. More...
 
static void display_player_sust_info (struct char_sheet_config *config)
 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...
 
static void init_ui_player (void)
 
static void cleanup_ui_player (void)
 

Variables

static struct char_sheet_configcached_config = NULL
 
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...
 
struct init_module ui_player_module
 

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().

Function Documentation

◆ check_for_two_categories()

static bool check_for_two_categories ( const struct ui_entry entry,
void closure 
)
static

◆ cleanup_ui_player()

static void cleanup_ui_player ( void  )
static

◆ configure_char_sheet()

static void configure_char_sheet ( void  )
static

◆ 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(), configure_char_sheet(), display_panel(), display_player_flag_info(), display_player_stat_info(), display_player_sust_info(), display_player_xtra_info(), have_valid_char_sheet_config(), 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

References display_resistance_panel(), and i.

Referenced by display_player().

◆ display_player_stat_info()

void display_player_stat_info ( void  )

◆ display_player_sust_info()

static void display_player_sust_info ( struct char_sheet_config config)
static

◆ display_player_xtra_info()

void display_player_xtra_info ( void  )

◆ display_resistance_panel()

static void display_resistance_panel ( int  ipart,
struct char_sheet_config config 
)
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

◆ have_valid_char_sheet_config()

static bool have_valid_char_sheet_config ( void  )
static

◆ init_ui_player()

static void init_ui_player ( 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().

◆ release_char_sheet_config()

static void release_char_sheet_config ( void  )
static

◆ 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

◆ cached_config

struct char_sheet_config* cached_config = NULL
static

◆ 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:702
static struct panel * get_panel_topleft(void)
Definition: ui-player.c:689
static struct panel * get_panel_skills(void)
Definition: ui-player.c:766
static struct panel * get_panel_misc(void)
Definition: ui-player.c:814
static struct panel * get_panel_combat(void)
Definition: ui-player.c:723

Panels for main character screen.

Referenced by display_player(), and display_player_xtra_info().

◆ ui_player_module

struct init_module ui_player_module
Initial value:
= {
.name = "ui-player",
.init = init_ui_player,
.cleanup = cleanup_ui_player
}
static void cleanup_ui_player(void)
Definition: ui-player.c:1254
static void init_ui_player(void)
Definition: ui-player.c:1248