Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
spawnpoints.qc File Reference
#include "spawnpoints.qh"
#include <client/hud/hud.qh>
#include <client/main.qh>
#include <client/view.qh>
#include <common/ent_cs.qh>
Include dependency graph for spawnpoints.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 NET_HANDLE (ENT_CLIENT_SPAWNEVENT, bool is_new)
 NET_HANDLE (ENT_CLIENT_SPAWNPOINT, bool is_new)
void Spawn_Draw (entity this)

Function Documentation

◆ NET_HANDLE() [1/2]

NET_HANDLE ( ENT_CLIENT_SPAWNEVENT ,
bool is_new )

Definition at line 40 of file spawnpoints.qc.

41{
42 // If entnum is 0, ONLY do the local spawn actions
43 // this way the server can disable the sending of
44 // spawn origin or such to clients if wanted.
45 float entnum = ReadByte();
46
47 if(entnum)
48 {
49 this.origin = ReadVector();
50
51 int teamnum = ReadByte() - 1;
52 int particlesAndOrSound = ReadByte();
53
54 if(is_new)
55 {
56 if(autocvar_cl_spawn_event_particles && (particlesAndOrSound & BIT(0)))
57 {
58 vector tcolor = (teamplay) ? Team_ColorRGB(teamnum) : entcs_GetColor(entnum - 1);
60 boxparticles(particleeffectnum(EFFECT_SPAWN), this, this.origin, this.origin, '0 0 0', '0 0 0', 1, PARTICLES_USECOLOR);
61 }
62
63 if(autocvar_cl_spawn_event_sound && (particlesAndOrSound & BIT(1)))
64 {
65 sound(this, CH_TRIGGER, SND_SPAWN, VOL_BASE, ATTEN_NORM);
66 }
67 }
68 }
69 return = true;
70
71 // local spawn actions
72 if(is_new && (!entnum || (entnum == player_localentnum)))
73 {
76 {
78 del &= ~1;
79 cvar_set("cl_autodemo_delete", ftos(del)); // don't delete demo where the player joined the match
80 }
81
83 {
84 zoomin_effect = 1;
86 }
87
89 {
90 localcmd("-zoom\n");
91 button_zoom = false;
92 }
94 }
95}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
float zoomin_effect
Definition main.qh:119
float current_viewzoom
Definition main.qh:118
bool button_zoom
Definition main.qh:113
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
Definition main.qh:197
bool autocvar_cl_unpress_zoom_on_spawn
Definition main.qh:7
bool warmup_stage
Definition main.qh:120
bool autocvar_cl_autodemo_delete_keepmatches
Definition main.qh:33
bool autocvar_cl_autodemo_delete
Definition main.qh:32
bool autocvar_cl_spawn_event_sound
Definition spawnpoints.qh:4
bool autocvar_cl_spawn_event_particles
Definition spawnpoints.qh:3
vector particles_colormin
vector particles_colormax
float player_localentnum
float entnum
vector origin
float PARTICLES_USECOLOR
#define particleeffectnum(e)
Definition effect.qh:3
vector entcs_GetColor(int i)
Definition ent_cs.qh:176
void HUD_Radar_Hide_Maximized()
Definition radar.qc:51
#define ReadVector()
Definition net.qh:367
int ReadByte()
void localcmd(string command,...)
void cvar_set(string name, string value)
float bound(float min, float value, float max)
string ftos(float f)
vector
Definition self.qh:92
const int CH_TRIGGER
Definition sound.qh:12
const float VOL_BASE
Definition sound.qh:36
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
vector Team_ColorRGB(int teamid)
Definition teams.qh:76
bool teamplay
Definition teams.qh:59
float autocvar_cl_spawnzoom_factor
Definition view.qh:25
bool autocvar_cl_lockview
Definition view.qh:20
bool autocvar_cl_spawnzoom
Definition view.qh:23

References ATTEN_NORM, autocvar_cl_autodemo_delete, autocvar_cl_autodemo_delete_keepmatches, autocvar_cl_lockview, autocvar_cl_spawn_event_particles, autocvar_cl_spawn_event_sound, autocvar_cl_spawnzoom, autocvar_cl_spawnzoom_factor, autocvar_cl_unpress_zoom_on_spawn, BIT, bound(), button_zoom, CH_TRIGGER, current_viewzoom, cvar_set(), entcs_GetColor(), entnum, ftos(), HUD_Radar_Hide_Maximized(), localcmd(), origin, particleeffectnum, particles_colormax, particles_colormin, PARTICLES_USECOLOR, player_localentnum, ReadByte(), ReadVector, sound, spectatee_status, Team_ColorRGB(), teamplay, vector, VOL_BASE, warmup_stage, and zoomin_effect.

◆ NET_HANDLE() [2/2]

NET_HANDLE ( ENT_CLIENT_SPAWNPOINT ,
bool is_new )

Definition at line 24 of file spawnpoints.qc.

25{
26 float teamnum = (ReadByte() - 1);
27 vector spn_origin = ReadVector();
28
29 this.team = (teamnum + 1);
30
31 this.origin = spn_origin;
32 setsize(this, PL_MIN_CONST, PL_MAX_CONST);
33
34 this.draw = Spawn_Draw;
35 if (is_new) IL_PUSH(g_drawables, this);
36
37 return true;
38}
IntrusiveList g_drawables
Definition main.qh:91
int team
Definition main.qh:188
void Spawn_Draw(entity this)
Definition spawnpoints.qc:8
const vector PL_MIN_CONST
Definition constants.qh:56
const vector PL_MAX_CONST
Definition constants.qh:55
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.

References g_drawables, IL_PUSH(), origin, PL_MAX_CONST, PL_MIN_CONST, ReadByte(), ReadVector, Spawn_Draw(), team, and vector.

◆ Spawn_Draw()

void Spawn_Draw ( entity this)

Definition at line 8 of file spawnpoints.qc.

9{
12 {
13 vector org = getpropertyvec(VF_ORIGIN);
15 }
16
17 if(dodraw)
18 {
20 boxparticles(particleeffectnum(EFFECT_SPAWNPOINT), this, this.absmin, this.absmax, '0 0 2', '0 0 2', bound(0, frametime, 0.1), PARTICLES_USECOLOR);
21 }
22}
bool autocvar_cl_spawn_point_particles
Definition spawnpoints.qh:5
float autocvar_cl_spawn_point_dist_max
Definition spawnpoints.qh:6
const float VF_ORIGIN
float frametime
vector absmax
vector absmin
vector org
Definition self.qh:92
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References absmax, absmin, autocvar_cl_spawn_point_dist_max, autocvar_cl_spawn_point_particles, bound(), entity(), frametime, org, origin, particleeffectnum, particles_colormax, particles_colormin, PARTICLES_USECOLOR, team, Team_ColorRGB(), vdist, vector, and VF_ORIGIN.

Referenced by NET_HANDLE().