Crossfire Client, Trunk
|
#include "client.h"
#include <assert.h>
#include <gtk/gtk.h>
#include "main.h"
#include "image.h"
#include "gtk2proto.h"
Go to the source code of this file.
Classes | |
struct | StatWindow |
Macros | |
#define | MAX_STAT_BARS 5 |
#define | NUM_STYLES 6 |
#define | PROTECTION_BOXES_X 6 |
#define | PROTECTION_BOXES_Y 6 |
#define | SKILL_BOXES_X 6 |
#define | SKILL_BOXES_Y 17 |
#define | STAT_BAR_EXP 4 |
#define | STAT_BAR_FOOD 3 |
#define | STAT_BAR_GRACE 2 |
#define | STAT_BAR_HP 0 |
#define | STAT_BAR_SP 1 |
#define | STYLE_GRAD_LOW 4 |
#define | STYLE_GRAD_NORMAL 3 |
#define | STYLE_GRAD_SUPER 5 |
#define | STYLE_LOW 1 |
#define | STYLE_NORMAL 0 |
#define | STYLE_SUPER 2 |
Functions | |
void | clear_stat_mapping () |
void | draw_message_window (int redraw) |
void | draw_stats (int redraw) |
static char * | format_si_number (gint64 number) |
static int | mapping_sort (NameMapping *a, NameMapping *b) |
void | stats_get_styles (void) |
void | stats_init (GtkWidget *window_root) |
void | update_stat (int stat_no, gint64 max_stat, gint64 current_stat, gint64 statbar_max, gint64 statbar_stat, int can_alert) |
static void | update_stat_mapping (void) |
Variables | |
GdkColor * | bar_colors [MAX_STAT_BARS][NUM_STYLES] |
static int | lastmax [MAX_STAT_BARS] |
static int | lastval [MAX_STAT_BARS] |
static gboolean | need_mapping_update |
static GtkWidget * | stat_bar [MAX_STAT_BARS] |
static const char *const | stat_bar_names [MAX_STAT_BARS] |
static const char *const | stat_style_names [NUM_STYLES] |
static StatWindow | statwindow |
Support for character statistics.
Definition in file stats.c.
void clear_stat_mapping | ( | ) |
Definition at line 771 of file stats.c.
References need_mapping_update.
Referenced by show_main_client().
void draw_message_window | ( | int | redraw | ) |
Updates the stats pane - hp, sp, etc labels
redraw |
Definition at line 459 of file stats.c.
References CONFIG_FOODBEEP, cpl, Stat_struct::exp, exp_table, exp_table_max, Stat_struct::food, Stat_struct::grace, Stat_struct::hp, Stat_struct::level, Stat_struct::maxgrace, Stat_struct::maxhp, Stat_struct::maxsp, Stat_struct::sp, STAT_BAR_EXP, STAT_BAR_FOOD, STAT_BAR_GRACE, STAT_BAR_HP, STAT_BAR_SP, Player_Struct::stats, update_stat(), and use_config.
Referenced by configure_keys(), load_theme(), and StatsCmd().
void draw_stats | ( | int | redraw | ) |
Draws the stats window. If redraw is true, it means we need to redraw the entire thing, and not just do an updated
Definition at line 554 of file stats.c.
References StatWindow::ac, Stat_struct::ac, StatWindow::armor, StatWindow::Cha, Stat_struct::Cha, StatWindow::Con, Stat_struct::Con, cpl, csocket, StatWindow::dam, Stat_struct::dam, StatWindow::Dex, Stat_struct::Dex, StatWindow::exp, Stat_struct::exp, FLOAT_MULTF, StatWindow::Int, Stat_struct::Int, StatWindow::level, Stat_struct::level, MAX_BUF, MAX_SKILL, NameMapping::name, need_mapping_update, NUM_RESISTS, StatWindow::playername, StatWindow::Pow, Stat_struct::Pow, PROTECTION_BOXES_X, PROTECTION_BOXES_Y, StatWindow::range, Player_Struct::range, redraw(), Stat_struct::resist_change, resist_mapping, StatWindow::resists, Stat_struct::resists, ClientSocket::sc_version, StatWindow::skill_exp, Stat_struct::skill_exp, Stat_struct::skill_level, skill_mapping, skill_names, StatWindow::speed, Stat_struct::speed, Player_Struct::stats, statwindow, StatWindow::Str, Stat_struct::Str, StatWindow::table_skills_exp, Player_Struct::title, update_skill_information(), update_stat_mapping(), NameMapping::value, StatWindow::wc, Stat_struct::wc, Stat_struct::weapon_sp, StatWindow::weapon_speed, StatWindow::Wis, and Stat_struct::Wis.
Referenced by load_theme(), read_config_dialog(), and StatsCmd().
|
static |
Format an integer using an appropriate SI prefix.
number | Number to format |
Definition at line 243 of file stats.c.
Referenced by update_stat().
|
static |
The mapping tables may not be completely full, so handle null values. Always treat null values as later in the sort order.
Definition at line 503 of file stats.c.
References NameMapping::name.
Referenced by update_stat_mapping().
void stats_get_styles | ( | void | ) |
Gets the style information for the stat bars (only portion of the window right now that has custom style support.
Definition at line 109 of file stats.c.
References bar_colors, has_init, LOG(), LOG_INFO, MAX_BUF, MAX_STAT_BARS, NUM_STYLES, stat_bar, stat_bar_names, and stat_style_names.
Referenced by load_theme().
void stats_init | ( | GtkWidget * | window_root | ) |
Associate the XML-defined widgets with pointers by name reference.
*window_root |
Definition at line 147 of file stats.c.
References StatWindow::ac, StatWindow::armor, StatWindow::Cha, StatWindow::Con, StatWindow::dam, StatWindow::Dex, StatWindow::exp, StatWindow::Int, lastmax, lastval, StatWindow::level, MAX_BUF, MAX_STAT_BARS, StatWindow::playername, StatWindow::Pow, PROTECTION_BOXES_X, PROTECTION_BOXES_Y, StatWindow::range, StatWindow::resists, SKILL_BOXES_X, SKILL_BOXES_Y, StatWindow::skill_exp, StatWindow::speed, stat_bar, stat_bar_names, statwindow, StatWindow::Str, StatWindow::table_protections, StatWindow::table_skills_exp, StatWindow::wc, StatWindow::weapon_speed, window_xml, and StatWindow::Wis.
Referenced by init_ui().
void update_stat | ( | int | stat_no, |
gint64 | max_stat, | ||
gint64 | current_stat, | ||
gint64 | statbar_max, | ||
gint64 | statbar_stat, | ||
int | can_alert | ||
) |
Updates the stat bar and text display as it pertains to a specific stat.
stat_no | The stat number to update. |
max_stat | The normal maximum value this stat can have. Note that within game terms, the actual value can go above this via supercharging stats. |
current_stat | current value of the stat. |
statbar_max | |
statbar_stat | this is the stat value to use for drawing the statbar. For most stats, this is same as current stat, but for the exp bar, we basically want it to be a graph relative to amount for next level. |
can_alert | Whether this stat can go on alert when it gets low. It doesn't make sense for this to happen on exp (not really an alert if you gain a level). Note: This is no longer used with the new style code - if a stat shouldn't ever change color when it is low, the style should dictate that. |
Definition at line 291 of file stats.c.
References bar_colors, CONFIG_GRAD_COLOR, format_si_number(), lastmax, lastval, stat_bar, STAT_BAR_EXP, STYLE_GRAD_LOW, STYLE_GRAD_NORMAL, STYLE_GRAD_SUPER, STYLE_LOW, STYLE_NORMAL, STYLE_SUPER, and use_config.
Referenced by draw_message_window().
|
static |
Definition at line 521 of file stats.c.
References mapping_sort(), MAX_SKILL, NameMapping::name, need_mapping_update, NUM_RESISTS, resist_mapping, resists_name, skill_mapping, skill_names, and NameMapping::value.
Referenced by draw_stats().
GdkColor* bar_colors[MAX_STAT_BARS][NUM_STYLES] |
Definition at line 61 of file stats.c.
Referenced by stats_get_styles(), and update_stat().
|
static |
Definition at line 103 of file stats.c.
Referenced by stats_init(), and update_stat().
|
static |
Definition at line 103 of file stats.c.
Referenced by stats_init(), and update_stat().
|
static |
Definition at line 101 of file stats.c.
Referenced by clear_stat_mapping(), draw_stats(), and update_stat_mapping().
|
static |
Definition at line 39 of file stats.c.
Referenced by stats_get_styles(), stats_init(), and update_stat().
|
static |
Definition at line 35 of file stats.c.
Referenced by stats_get_styles(), and stats_init().
|
static |
Definition at line 53 of file stats.c.
Referenced by stats_get_styles().
|
static |
Definition at line 99 of file stats.c.
Referenced by draw_stats(), and stats_init().