Xonotic
weapons.qh File Reference
#include "../panel.qh"
+ Include dependency graph for weapons.qh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

vector Accuracy_GetColor (float accuracy)
 
void Accuracy_LoadColors ()
 
void Accuracy_LoadLevels ()
 

Variables

vector acc_col [MAX_ACCURACY_LEVELS]
 
float acc_col_loadtime
 
string acc_color_levels
 
float acc_lev [MAX_ACCURACY_LEVELS]
 
int acc_levels
 
string autocvar_accuracy_color_levels
 
string autocvar_cl_weaponpriority
 
bool autocvar_hud_panel_weapons
 
bool autocvar_hud_panel_weapons_accuracy
 
bool autocvar_hud_panel_weapons_ammo
 
float autocvar_hud_panel_weapons_ammo_alpha
 
string autocvar_hud_panel_weapons_ammo_color
 
int autocvar_hud_panel_weapons_ammo_full_cells
 
int autocvar_hud_panel_weapons_ammo_full_fuel
 
int autocvar_hud_panel_weapons_ammo_full_nails
 
int autocvar_hud_panel_weapons_ammo_full_plasma
 
int autocvar_hud_panel_weapons_ammo_full_rockets
 
int autocvar_hud_panel_weapons_ammo_full_shells
 
float autocvar_hud_panel_weapons_aspect
 
bool autocvar_hud_panel_weapons_complainbubble
 
string autocvar_hud_panel_weapons_complainbubble_color_donthave
 
string autocvar_hud_panel_weapons_complainbubble_color_outofammo
 
string autocvar_hud_panel_weapons_complainbubble_color_unavailable
 
float autocvar_hud_panel_weapons_complainbubble_fadetime
 
float autocvar_hud_panel_weapons_complainbubble_padding
 
float autocvar_hud_panel_weapons_complainbubble_time
 
bool autocvar_hud_panel_weapons_dynamichud = true
 
bool autocvar_hud_panel_weapons_hide_ondeath = false
 
int autocvar_hud_panel_weapons_label
 
float autocvar_hud_panel_weapons_label_scale = 0.5
 
float autocvar_hud_panel_weapons_noncurrent_alpha = 1
 
float autocvar_hud_panel_weapons_noncurrent_scale = 1
 
int autocvar_hud_panel_weapons_onlyowned
 
bool autocvar_hud_panel_weapons_orderbyimpulse = true
 
float autocvar_hud_panel_weapons_selection_radius = 0
 
float autocvar_hud_panel_weapons_selection_speed = 10
 
float autocvar_hud_panel_weapons_timeout
 
int autocvar_hud_panel_weapons_timeout_effect
 
float autocvar_hud_panel_weapons_timeout_fadebgmin
 
float autocvar_hud_panel_weapons_timeout_fadefgmin
 
float autocvar_hud_panel_weapons_timeout_speed_in = 0.25
 
float autocvar_hud_panel_weapons_timeout_speed_out = 0.75
 
const int MAX_ACCURACY_LEVELS = 10
 

Function Documentation

◆ Accuracy_GetColor()

vector Accuracy_GetColor ( float  accuracy)

Definition at line 67 of file weapons.qc.

References acc_col, acc_lev, acc_levels, color, and vector().

Referenced by HUD_Weapons().

68 {
69  float factor;
70  vector color;
71  if(acc_levels < 2)
72  return '0 0 0'; // return black, can't determine the right color
73 
74  // find the max level lower than acc
75  int j = acc_levels-1;
76  while(j && accuracy < acc_lev[j])
77  --j;
78 
79  // inject color j+1 in color j, how much depending on how much accuracy is higher than level j
80  factor = (accuracy - acc_lev[j]) / (acc_lev[j+1] - acc_lev[j]);
81  color = acc_col[j];
82  color = color + factor * (acc_col[j+1] - color);
83  return color;
84 }
vector color
float acc_lev[MAX_ACCURACY_LEVELS]
Definition: weapons.qh:44
entity accuracy
Definition: accuracy.qh:26
int acc_levels
Definition: weapons.qh:47
vector(float skel, float bonenum) _skel_get_boneabs_hidden
vector acc_col[MAX_ACCURACY_LEVELS]
Definition: weapons.qh:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Accuracy_LoadColors()

void Accuracy_LoadColors ( )

Definition at line 55 of file weapons.qc.

References acc_col, acc_col_loadtime, acc_levels, cvar_string(), ftos(), stov(), strcat(), and time.

Referenced by HUD_Weapons().

56 {
58  if(acc_levels >= 2)
59  {
60  int i;
61  for(i = 0; i < acc_levels; ++i)
62  acc_col[i] = stov(cvar_string(strcat("accuracy_color", ftos(i))));
63  acc_col_loadtime = time + 2;
64  }
65 }
float acc_col_loadtime
Definition: weapons.qh:46
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
int acc_levels
Definition: weapons.qh:47
vector acc_col[MAX_ACCURACY_LEVELS]
Definition: weapons.qh:45
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Accuracy_LoadLevels()

void Accuracy_LoadLevels ( )

Definition at line 38 of file weapons.qc.

References acc_color_levels, acc_lev, acc_levels, argv(), autocvar_accuracy_color_levels, LOG_INFO, MAX_ACCURACY_LEVELS, stof(), strcpy, and tokenize_console.

39 {
41  {
46  if(acc_levels < 2)
47  LOG_INFO("Warning: accuracy_color_levels must contain at least 2 values");
48 
49  int i;
50  for(i = 0; i < acc_levels; ++i)
51  acc_lev[i] = stof(argv(i)) / 100.0;
52  }
53 }
float acc_lev[MAX_ACCURACY_LEVELS]
Definition: weapons.qh:44
#define strcpy(this, s)
Definition: string.qh:49
int acc_levels
Definition: weapons.qh:47
string autocvar_accuracy_color_levels
Definition: weapons.qh:40
#define LOG_INFO(...)
Definition: log.qh:70
#define tokenize_console
Definition: dpextensions.qh:24
const int MAX_ACCURACY_LEVELS
Definition: weapons.qh:43
string acc_color_levels
Definition: weapons.qh:48
+ Here is the call graph for this function:

Variable Documentation

◆ acc_col

Definition at line 45 of file weapons.qh.

Referenced by Accuracy_GetColor(), and Accuracy_LoadColors().

◆ acc_col_loadtime

float acc_col_loadtime

Definition at line 46 of file weapons.qh.

Referenced by Accuracy_LoadColors().

◆ acc_color_levels

string acc_color_levels

Definition at line 48 of file weapons.qh.

Referenced by Accuracy_LoadLevels().

◆ acc_lev

Definition at line 44 of file weapons.qh.

Referenced by Accuracy_GetColor(), and Accuracy_LoadLevels().

◆ acc_levels

int acc_levels

Definition at line 47 of file weapons.qh.

Referenced by Accuracy_GetColor(), Accuracy_LoadColors(), and Accuracy_LoadLevels().

◆ autocvar_accuracy_color_levels

string autocvar_accuracy_color_levels

Definition at line 40 of file weapons.qh.

Referenced by Accuracy_LoadLevels().

◆ autocvar_cl_weaponpriority

string autocvar_cl_weaponpriority

Definition at line 41 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons

bool autocvar_hud_panel_weapons

Definition at line 4 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_accuracy

bool autocvar_hud_panel_weapons_accuracy

Definition at line 5 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo

bool autocvar_hud_panel_weapons_ammo

Definition at line 6 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo_alpha

float autocvar_hud_panel_weapons_ammo_alpha

Definition at line 7 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo_color

string autocvar_hud_panel_weapons_ammo_color

Definition at line 8 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo_full_cells

int autocvar_hud_panel_weapons_ammo_full_cells

Definition at line 9 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo_full_fuel

int autocvar_hud_panel_weapons_ammo_full_fuel

Definition at line 11 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo_full_nails

int autocvar_hud_panel_weapons_ammo_full_nails

Definition at line 12 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo_full_plasma

int autocvar_hud_panel_weapons_ammo_full_plasma

Definition at line 10 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo_full_rockets

int autocvar_hud_panel_weapons_ammo_full_rockets

Definition at line 13 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_ammo_full_shells

int autocvar_hud_panel_weapons_ammo_full_shells

Definition at line 14 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_aspect

float autocvar_hud_panel_weapons_aspect

Definition at line 15 of file weapons.qh.

Referenced by HUD_Weapons(), and Scoreboard_AccuracyStats_Draw().

◆ autocvar_hud_panel_weapons_complainbubble

bool autocvar_hud_panel_weapons_complainbubble

Definition at line 16 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_complainbubble_color_donthave

string autocvar_hud_panel_weapons_complainbubble_color_donthave

Definition at line 17 of file weapons.qh.

◆ autocvar_hud_panel_weapons_complainbubble_color_outofammo

string autocvar_hud_panel_weapons_complainbubble_color_outofammo

Definition at line 18 of file weapons.qh.

◆ autocvar_hud_panel_weapons_complainbubble_color_unavailable

string autocvar_hud_panel_weapons_complainbubble_color_unavailable

Definition at line 19 of file weapons.qh.

◆ autocvar_hud_panel_weapons_complainbubble_fadetime

float autocvar_hud_panel_weapons_complainbubble_fadetime

Definition at line 20 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_complainbubble_padding

float autocvar_hud_panel_weapons_complainbubble_padding

Definition at line 21 of file weapons.qh.

◆ autocvar_hud_panel_weapons_complainbubble_time

float autocvar_hud_panel_weapons_complainbubble_time

Definition at line 22 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_dynamichud

bool autocvar_hud_panel_weapons_dynamichud = true

Definition at line 23 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_hide_ondeath

bool autocvar_hud_panel_weapons_hide_ondeath = false

Definition at line 24 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_label

int autocvar_hud_panel_weapons_label

Definition at line 25 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_label_scale

float autocvar_hud_panel_weapons_label_scale = 0.5

Definition at line 26 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_noncurrent_alpha

float autocvar_hud_panel_weapons_noncurrent_alpha = 1

Definition at line 28 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_noncurrent_scale

float autocvar_hud_panel_weapons_noncurrent_scale = 1

Definition at line 29 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_onlyowned

int autocvar_hud_panel_weapons_onlyowned

Definition at line 27 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_orderbyimpulse

bool autocvar_hud_panel_weapons_orderbyimpulse = true

Definition at line 34 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_selection_radius

float autocvar_hud_panel_weapons_selection_radius = 0

Definition at line 30 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_selection_speed

float autocvar_hud_panel_weapons_selection_speed = 10

Definition at line 31 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_timeout

float autocvar_hud_panel_weapons_timeout

Definition at line 32 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_timeout_effect

int autocvar_hud_panel_weapons_timeout_effect

Definition at line 33 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_timeout_fadebgmin

float autocvar_hud_panel_weapons_timeout_fadebgmin

Definition at line 35 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_timeout_fadefgmin

float autocvar_hud_panel_weapons_timeout_fadefgmin

Definition at line 36 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_timeout_speed_in

float autocvar_hud_panel_weapons_timeout_speed_in = 0.25

Definition at line 37 of file weapons.qh.

Referenced by HUD_Weapons().

◆ autocvar_hud_panel_weapons_timeout_speed_out

float autocvar_hud_panel_weapons_timeout_speed_out = 0.75

Definition at line 38 of file weapons.qh.

Referenced by HUD_Weapons().

◆ MAX_ACCURACY_LEVELS

const int MAX_ACCURACY_LEVELS = 10

Definition at line 43 of file weapons.qh.

Referenced by Accuracy_LoadLevels().