Crossfire Client, Branches
R11627
|
#include <assert.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "client.h"
#include "main.h"
Go to the source code of this file.
Data Structures | |
struct | NameMapping |
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) |
void | draw_message_window (int redraw) |
void | draw_stats (int redraw) |
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, sint64 max_stat, sint64 current_stat, sint64 statbar_max, sint64 statbar_stat, const char *name, 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] |
int | need_mapping_update =1 |
const char *const | rcsid_gtk2_stats_c |
NameMapping | resist_mapping [NUM_RESISTS] |
NameMapping | skill_mapping [MAX_SKILL] |
GtkWidget * | stat_bar [MAX_STAT_BARS] |
static const char *const | stat_bar_names [MAX_STAT_BARS] |
GtkWidget * | stat_label [MAX_STAT_BARS] |
static const char *const | stat_style_names [NUM_STYLES] |
static StatWindow | statwindow |
Support for character statistics.
Definition in file stats.c.
#define MAX_STAT_BARS 5 |
Definition at line 47 of file stats.c.
Referenced by stats_get_styles(), and stats_init().
#define NUM_STYLES 6 |
Definition at line 60 of file stats.c.
Referenced by stats_get_styles().
#define PROTECTION_BOXES_X 6 |
Definition at line 86 of file stats.c.
Referenced by draw_stats(), and stats_init().
#define PROTECTION_BOXES_Y 6 |
Definition at line 87 of file stats.c.
Referenced by draw_stats(), and stats_init().
#define SKILL_BOXES_X 6 |
Definition at line 83 of file stats.c.
Referenced by stats_init().
#define SKILL_BOXES_Y 17 |
Definition at line 84 of file stats.c.
Referenced by stats_init().
#define STYLE_GRAD_LOW 4 |
Definition at line 58 of file stats.c.
Referenced by update_stat().
#define STYLE_GRAD_NORMAL 3 |
Definition at line 57 of file stats.c.
Referenced by update_stat().
#define STYLE_GRAD_SUPER 5 |
Definition at line 59 of file stats.c.
Referenced by update_stat().
#define STYLE_LOW 1 |
Definition at line 55 of file stats.c.
Referenced by update_stat().
#define STYLE_NORMAL 0 |
Definition at line 54 of file stats.c.
Referenced by update_stat().
#define STYLE_SUPER 2 |
Definition at line 56 of file stats.c.
Referenced by update_stat().
void clear_stat_mapping | ( | void | ) |
Definition at line 725 of file stats.c.
References need_mapping_update.
Referenced by main().
void draw_message_window | ( | int | redraw | ) |
Updates the stats pain - hp, sp, etc labels
redraw |
Definition at line 437 of file stats.c.
References CONFIG_FOODBEEP, cpl, Stat_struct::exp, exp_table, exp_table_max, FALSE, Stat_struct::food, Stat_struct::grace, Stat_struct::hp, Stat_struct::level, Stat_struct::maxgrace, Stat_struct::maxhp, Stat_struct::maxsp, Stat_struct::sp, Player_Struct::stats, TRUE, update_stat(), and use_config.
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 522 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, last_stats, 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, Stat_struct::resist_change, StatWindow::resists, Stat_struct::resists, ClientSocket::sc_version, StatWindow::skill_exp, Stat_struct::skill_exp, Stat_struct::skill_level, skill_names, StatWindow::speed, Stat_struct::speed, Player_Struct::stats, StatWindow::Str, Stat_struct::Str, Player_Struct::title, update_stat_mapping(), NameMapping::value, StatWindow::wc, Stat_struct::wc, Stat_struct::weapon_sp, StatWindow::weapon_speed, StatWindow::Wis, and Stat_struct::Wis.
|
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 480 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 139 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(), and stats_init().
void stats_init | ( | GtkWidget * | window_root | ) |
*window_root |
Definition at line 176 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, stat_label, stats_get_styles(), StatWindow::Str, StatWindow::table_protections, StatWindow::table_skills_exp, StatWindow::wc, StatWindow::weapon_speed, and StatWindow::Wis.
Referenced by main().
void update_stat | ( | int | stat_no, |
sint64 | max_stat, | ||
sint64 | current_stat, | ||
sint64 | statbar_max, | ||
sint64 | statbar_stat, | ||
const char * | name, | ||
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. |
name | Printable name of the stat. |
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 292 of file stats.c.
References bar_colors, CONFIG_GRAD_COLOR, lastmax, lastval, stat_bar, stat_label, 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 491 of file stats.c.
References mapping_sort(), MAX_SKILL, NameMapping::name, need_mapping_update, NUM_RESISTS, resists_name, skill_names, and NameMapping::value.
Referenced by draw_stats().
GdkColor* bar_colors[MAX_STAT_BARS][NUM_STYLES] |
Definition at line 75 of file stats.c.
Referenced by stats_get_styles(), and update_stat().
|
static |
Definition at line 133 of file stats.c.
Referenced by stats_init(), and update_stat().
|
static |
Definition at line 133 of file stats.c.
Referenced by stats_init(), and update_stat().
int need_mapping_update =1 |
Definition at line 131 of file stats.c.
Referenced by clear_stat_mapping(), draw_stats(), and update_stat_mapping().
const char* const rcsid_gtk2_stats_c |
NameMapping resist_mapping[NUM_RESISTS] |
NameMapping skill_mapping[MAX_SKILL] |
GtkWidget * stat_bar[MAX_STAT_BARS] |
Definition at line 52 of file stats.c.
Referenced by stats_get_styles(), stats_init(), and update_stat().
|
static |
Definition at line 48 of file stats.c.
Referenced by stats_get_styles(), and stats_init().
GtkWidget* stat_label[MAX_STAT_BARS] |
Definition at line 52 of file stats.c.
Referenced by stats_init(), and update_stat().
|
static |
Definition at line 66 of file stats.c.
Referenced by stats_get_styles().
|
static |