Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
net_notice.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void cl_notice_read ()
void cl_notice_run ()
void sv_notice_join (entity _to)
void sv_notice_to (entity _to, string _notice, float _howlong, float _modal)
void sv_notice_toall (string _notice, float _howlong, float _modal)

Variables

string autocvar_sv_join_notices
float autocvar_sv_join_notices_time

Function Documentation

◆ cl_notice_read()

void cl_notice_read ( )

Definition at line 44 of file net_notice.qc.

45{
46 entity _notice = new_pure(sv_notice);
47 _notice.netname = strzone(ReadString());
48 _notice.alpha = ReadLong() + time;
49 _notice.skin = ReadByte();
50 if(!cl_notices)
52 LL_PUSH(cl_notices, _notice);
53}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define ReadString
float time
int ReadByte()
#define LL_NEW()
Definition linkedlist.qh:14
entity LL_PUSH(LinkedList this, entity e)
Push to tail.
Definition linkedlist.qh:21
string strzone(string s)
entity cl_notices
Definition net_notice.qc:43
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67

References cl_notices, entity(), LL_NEW, LL_PUSH(), new_pure, ReadByte(), ReadString, strzone(), and time.

Referenced by NET_HANDLE().

◆ cl_notice_run()

void cl_notice_run ( )

Definition at line 55 of file net_notice.qc.

56{
57 if (!cl_notices)
58 return;
59
60 bool flag = false;
61 LL_EACH(cl_notices, it.alpha > time, { flag = true; break; });
62 if (!flag)
63 {
65 return;
66 }
67
68 const int M1 = 30;
69 const int M2 = 10;
70
71 vector v1 = '1 1 0' * M1;
72 vector v2 = '0 0 0';
73 v2.x = vid_conwidth - (2 * M1);
74 v2.y = vid_conheight - (2 * M1);
75 drawfill(v1, v2, '0 0 0', 0.5, DRAWFLAG_NORMAL);
76
77 v1 = '1 1 0' * (M1 + M2);
78 v2.x = vid_conwidth - (2 * (M1 + M2));
79 v2.y = vid_conheight - (2 * (M1 + M2));
80 drawfill(v1, v2, '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
81
82 vector v3 = v1 + '10 10 0';
83 #define OUT(s, z) MACRO_BEGIN \
84 drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); \
85 v3.y += z + 4; \
86 MACRO_END
87
88 float cur_time = 0;
89 float time_width = 48;
90 OUT(_("^1Server notices:"), 32);
91 LL_EACH(cl_notices, it.alpha > time, {
92 if(it.alpha - cur_time > 0.1)
93 {
94 cur_time = it.alpha;
95 string s = sprintf("^3%d", ceil(cur_time - time));
96 drawcolorcodedstring(v3 + eX * 0.5 * (time_width - stringwidth(s, true, '1 1 0' * 16)), s, '1 1 0' * 16, 1, DRAWFLAG_NORMAL);
97 v3.x = v1.x + 10 + time_width;
98 }
99 OUT(it.netname, 16);
100 });
101 #undef OUT
102}
#define drawfill(position, size, rgb, alpha, flag)
Definition draw.qh:36
const float DRAWFLAG_NORMAL
noref float vid_conwidth
Definition draw.qh:8
noref float vid_conheight
Definition draw.qh:9
#define LL_DELETE(...)
Definition linkedlist.qh:63
#define LL_EACH(list, cond, body)
Definition linkedlist.qh:73
#define OUT(s, z)
vector
Definition self.qh:92

References cl_notices, drawfill, DRAWFLAG_NORMAL, LL_DELETE, LL_EACH, OUT, time, vector, vid_conheight, and vid_conwidth.

Referenced by CSQC_UpdateView().

◆ sv_notice_join()

void sv_notice_join ( entity _to)

Definition at line 14 of file net_notice.qc.

15{
16 // to-do: make sv_join_notices support per-entry times
17 if (autocvar_sv_join_notices == "") return;
19}
void defer(entity this, float fdelay, void(entity) func)
Execute func() after time + fdelay.
Definition defer.qh:29
void sv_notice_join_think(entity this)
Definition net_notice.qc:6
string autocvar_sv_join_notices
Definition net_notice.qh:4

References autocvar_sv_join_notices, defer(), entity(), and sv_notice_join_think().

Referenced by ClientConnect().

◆ sv_notice_to()

void sv_notice_to ( entity _to,
string _notice,
float _howlong,
float _modal )

Definition at line 21 of file net_notice.qc.

22{
23 msg_entity = _to;
24 WriteHeader(MSG_ONE, TE_CSQC_SVNOTICE);
25 WriteString(MSG_ONE, _notice);
26 WriteLong(MSG_ONE, _howlong);
27 WriteByte(MSG_ONE, _modal);
28}
#define WriteHeader(to, id)
Definition net.qh:221
float MSG_ONE
Definition menudefs.qc:56
void WriteLong(float data, float dest, float desto)
void WriteString(string data, float dest, float desto)
void WriteByte(float data, float dest, float desto)
entity msg_entity
Definition progsdefs.qc:63

References entity(), msg_entity, MSG_ONE, WriteByte(), WriteHeader, WriteLong(), and WriteString().

Referenced by sv_notice_join_think(), and sv_notice_toall().

◆ sv_notice_toall()

void sv_notice_toall ( string _notice,
float _howlong,
float _modal )

Definition at line 30 of file net_notice.qc.

31{
32 FOREACH_CLIENT(IS_REAL_CLIENT(it), sv_notice_to(it, _notice, _howlong, _modal));
33}
void sv_notice_to(entity _to, string _notice, float _howlong, float _modal)
Definition net_notice.qc:21
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50

References FOREACH_CLIENT, IS_REAL_CLIENT, and sv_notice_to().

Variable Documentation

◆ autocvar_sv_join_notices

string autocvar_sv_join_notices

Definition at line 4 of file net_notice.qh.

Referenced by sv_notice_join(), and sv_notice_join_think().

◆ autocvar_sv_join_notices_time

float autocvar_sv_join_notices_time

Definition at line 5 of file net_notice.qh.

Referenced by sv_notice_join_think().