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

Go to the source code of this file.

Functions

bool cpicon_send (entity this, entity to, int sf)
void onslaught_controlpoint_icon_link (entity e, void(entity this) spawnproc)

Variables

bool iscaptured

Function Documentation

◆ cpicon_send()

bool cpicon_send ( entity this,
entity to,
int sf )

Definition at line 5 of file sv_controlpoint.qc.

6{
7 WriteHeader(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON);
8 if(sf & CPSF_SETUP)
9 sf &= ~CPSF_STATUS;
11 if(sf & CPSF_SETUP)
12 {
13 WriteVector(MSG_ENTITY, this.origin);
14
15 WriteByte(MSG_ENTITY, GetResource(this, RES_HEALTH));
19 WriteByte(MSG_ENTITY, this.owner.iscaptured);
20 }
21
22 if(sf & CPSF_STATUS)
23 {
25
26 if(GetResource(this, RES_HEALTH) <= 0)
28 else
29 WriteByte(MSG_ENTITY, ceil((GetResource(this, RES_HEALTH) / this.max_health) * 255));
30 }
31
32 return true;
33}
float max_health
const int CPSF_SETUP
const int CPSF_STATUS
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
float count
Definition powerups.qc:22
entity owner
Definition main.qh:87
int team
Definition main.qh:188
vector origin
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
float ceil(float f)
void WriteByte(float data, float dest, float desto)

References ceil(), count, CPSF_SETUP, CPSF_STATUS, entity(), GetResource(), max_health, MSG_ENTITY, origin, owner, team, WriteByte(), and WriteHeader.

Referenced by onslaught_controlpoint_icon_link().

◆ onslaught_controlpoint_icon_link()

void onslaught_controlpoint_icon_link ( entity e,
void(entity this) spawnproc )

Definition at line 35 of file sv_controlpoint.qc.

36{
37 Net_LinkEntity(e, true, 0, cpicon_send);
38 setthink(e, spawnproc);
39 e.nextthink = time + sys_frametime;
40}
float time
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
#define setthink(e, f)
float sys_frametime
Definition common.qh:57
bool cpicon_send(entity this, entity to, int sf)

References cpicon_send(), entity(), Net_LinkEntity(), setthink, sys_frametime, and time.

Referenced by ons_ControlPoint_Icon_Spawn().

Variable Documentation

◆ iscaptured

bool iscaptured

Definition at line 3 of file sv_controlpoint.qc.