Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
centerprint.qh File Reference
#include "../panel.qh"
Include dependency graph for centerprint.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void centerprint_Add (int new_id, string strMessage, float duration, int countdown_num)
void centerprint_AddStandard (string strMessage)
void centerprint_ClearTitle ()
void centerprint_Kill (int id)
void centerprint_KillAll ()
void centerprint_SetDuelTitle (string left, string right)
void centerprint_SetTitle (string title)

Variables

bool autocvar_hud_panel_centerprint
float autocvar_hud_panel_centerprint_align
bool autocvar_hud_panel_centerprint_dynamichud = true
float autocvar_hud_panel_centerprint_fade_in = 0.15
float autocvar_hud_panel_centerprint_fade_minfontsize = 1
float autocvar_hud_panel_centerprint_fade_out = 0.15
float autocvar_hud_panel_centerprint_fade_subsequent = 1
float autocvar_hud_panel_centerprint_fade_subsequent_passone = 3
float autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha = 0.5
float autocvar_hud_panel_centerprint_fade_subsequent_passtwo = 10
float autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha = 0.5
bool autocvar_hud_panel_centerprint_flip
float autocvar_hud_panel_centerprint_fontscale = 1
float autocvar_hud_panel_centerprint_fontscale_bold = 1.4
float autocvar_hud_panel_centerprint_fontscale_title = 1.8
float autocvar_hud_panel_centerprint_time

Function Documentation

◆ centerprint_Add()

void centerprint_Add ( int new_id,
string strMessage,
float duration,
int countdown_num )

Definition at line 52 of file centerprint.qc.

53{
54 TC(int, new_id); TC(int, countdown_num);
55 //LOG_INFOF("centerprint_Add: ^2id: %d ^3dur: %d ^5countdown: %d\n'%s'", new_id, duration, countdown_num, strreplace("\n", "^7\\n^7", strMessage));
56
57 if (strMessage == "" && new_id == 0)
58 return;
59
60 // strip trailing newlines
61 int j = strlen(strMessage) - 1;
62 while (substring(strMessage, j, 1) == "\n" && j >= 0)
63 --j;
64 if (j < strlen(strMessage) - 1)
65 strMessage = substring(strMessage, 0, j + 1);
66
67 if (strMessage == "" && new_id == 0)
68 return;
69
70 // strip leading newlines
71 j = 0;
72 while (substring(strMessage, j, 1) == "\n" && j < strlen(strMessage))
73 ++j;
74 if (j > 0)
75 strMessage = substring(strMessage, j, strlen(strMessage) - j);
76
77 if (strMessage == "" && new_id == 0)
78 return;
79
82
83 int i;
84 for (i = 0, j = cpm_index; i < CENTERPRINT_MAX_MSGS; ++i, ++j)
85 {
86 if (j == CENTERPRINT_MAX_MSGS)
87 j = 0;
88 if (new_id && new_id == centerprint_msgID[j])
89 {
90 if (strMessage == "" && centerprint_messages[j] != "")
91 {
92 // fade out the current msg (duration and countdown_num are ignored)
95 centerprint_expire_time[j] = -1; // don't use the variable time here!
96 return;
97 }
98 break; // found a msg with the same id, at position j
99 }
100 }
101
102 if (strMessage == "")
103 return;
104
105 if (i == CENTERPRINT_MAX_MSGS)
106 {
107 // a msg with the same id was not found, add the msg at the next position
108 --cpm_index;
109 if (cpm_index == -1)
111 j = cpm_index;
112 }
113 strcpy(centerprint_messages[j], strMessage);
115 centerprint_msgID[j] = new_id;
116 if (duration < 0)
117 {
118 centerprint_time[j] = -1;
119 centerprint_expire_time[j] = -1; // don't use the variable time here!
120 }
121 else
122 {
123 if (duration == 0)
125 centerprint_time[j] = duration;
126 centerprint_expire_time[j] = -1; // don't use the variable time here!
127 }
128 centerprint_countdown_num[j] = countdown_num;
129}
int centerprint_msgID[CENTERPRINT_MAX_MSGS]
int cpm_index
const int CENTERPRINT_MAX_MSGS
bool centerprint_showing
string centerprint_messages[CENTERPRINT_MAX_MSGS]
int centerprint_countdown_num[CENTERPRINT_MAX_MSGS]
float centerprint_time[CENTERPRINT_MAX_MSGS]
float centerprint_expire_time[CENTERPRINT_MAX_MSGS]
float centerprint_start_time[CENTERPRINT_MAX_MSGS]
float autocvar_hud_panel_centerprint_fade_out
Definition centerprint.qh:7
float autocvar_hud_panel_centerprint_time
float time
#define strlen
#define TC(T, sym)
Definition _all.inc:82
string substring(string s, float start, float length)
float min(float f,...)
float max(float f,...)
#define strcpy(this, s)
Definition string.qh:52

References autocvar_hud_panel_centerprint_fade_out, autocvar_hud_panel_centerprint_time, centerprint_countdown_num, centerprint_expire_time, CENTERPRINT_MAX_MSGS, centerprint_messages, centerprint_msgID, centerprint_showing, centerprint_start_time, centerprint_time, cpm_index, max(), min(), strcpy, strlen, substring(), TC, and time.

Referenced by centerprint_AddStandard(), centerprint_Kill(), HUD_CenterPrint(), and Local_Notification_centerprint_Add().

◆ centerprint_AddStandard()

void centerprint_AddStandard ( string strMessage)

Definition at line 137 of file centerprint.qc.

138{
140}
void centerprint_Add(int new_id, string strMessage, float duration, int countdown_num)

References autocvar_hud_panel_centerprint_time, and centerprint_Add().

Referenced by CSQC_Parse_CenterPrint(), HUD_CenterPrint(), and LocalCommand_localprint().

◆ centerprint_ClearTitle()

void centerprint_ClearTitle ( )

Definition at line 167 of file centerprint.qc.

168{
172}
string centerprint_title_left
string centerprint_title_right
string centerprint_title
#define strfree(this)
Definition string.qh:59

References centerprint_title, centerprint_title_left, centerprint_title_right, and strfree.

Referenced by Announcer_ClearTitle(), and HUD_CenterPrint().

◆ centerprint_Kill()

void centerprint_Kill ( int id)

Definition at line 131 of file centerprint.qc.

132{
133 TC(int, id);
134 centerprint_Add(id, "", 0, 0);
135}

References centerprint_Add(), and TC.

Referenced by Announcer_Gamestart(), and NET_HANDLE().

◆ centerprint_KillAll()

void centerprint_KillAll ( )

◆ centerprint_SetDuelTitle()

void centerprint_SetDuelTitle ( string left,
string right )

Definition at line 154 of file centerprint.qc.

155{
159}
vector hud_fontsize
Definition main.qh:77
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
Definition util.qc:1071
float autocvar_hud_panel_scoreboard_namesize
Definition scoreboard.qh:7
float stringwidth_colors(string s, vector theSize)
Definition string.qh:30

References autocvar_hud_panel_scoreboard_namesize, centerprint_title_left, centerprint_title_right, hud_fontsize, strcpy, stringwidth_colors(), and textShortenToWidth().

Referenced by Announcer_Duel().

◆ centerprint_SetTitle()

void centerprint_SetTitle ( string title)

Definition at line 161 of file centerprint.qc.

162{
163 if (title != centerprint_title)
165}
string CCR(string input)
color code replace, place inside of sprintf and parse the string
Definition string.qh:216

References CCR(), centerprint_title, and strcpy.

Referenced by Announcer_Gamestart(), and HUD_CenterPrint().

Variable Documentation

◆ autocvar_hud_panel_centerprint

bool autocvar_hud_panel_centerprint

Definition at line 4 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_align

float autocvar_hud_panel_centerprint_align

Definition at line 5 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_dynamichud

bool autocvar_hud_panel_centerprint_dynamichud = true

Definition at line 18 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fade_in

float autocvar_hud_panel_centerprint_fade_in = 0.15

Definition at line 6 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fade_minfontsize

float autocvar_hud_panel_centerprint_fade_minfontsize = 1

Definition at line 13 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fade_out

float autocvar_hud_panel_centerprint_fade_out = 0.15

Definition at line 7 of file centerprint.qh.

Referenced by centerprint_Add(), and HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fade_subsequent

float autocvar_hud_panel_centerprint_fade_subsequent = 1

Definition at line 8 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fade_subsequent_passone

float autocvar_hud_panel_centerprint_fade_subsequent_passone = 3

Definition at line 9 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha

float autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha = 0.5

Definition at line 10 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fade_subsequent_passtwo

float autocvar_hud_panel_centerprint_fade_subsequent_passtwo = 10

Definition at line 11 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha

float autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha = 0.5

Definition at line 12 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_flip

bool autocvar_hud_panel_centerprint_flip

Definition at line 14 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fontscale

float autocvar_hud_panel_centerprint_fontscale = 1

Definition at line 15 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fontscale_bold

float autocvar_hud_panel_centerprint_fontscale_bold = 1.4

Definition at line 16 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_fontscale_title

float autocvar_hud_panel_centerprint_fontscale_title = 1.8

Definition at line 17 of file centerprint.qh.

Referenced by HUD_CenterPrint().

◆ autocvar_hud_panel_centerprint_time

float autocvar_hud_panel_centerprint_time

Definition at line 19 of file centerprint.qh.

Referenced by centerprint_Add(), and centerprint_AddStandard().