Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
spawnpoints.qc
Go to the documentation of this file.
1#include "spawnpoints.qh"
2
3#include <client/hud/hud.qh>
4#include <client/main.qh>
5#include <client/view.qh>
6#include <common/ent_cs.qh>
7
8void Spawn_Draw(entity this)
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}
23
24NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new)
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}
39
40NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new)
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
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float zoomin_effect
Definition main.qh:119
float current_viewzoom
Definition main.qh:118
IntrusiveList g_drawables
Definition main.qh:91
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
int team
Definition main.qh:188
bool autocvar_cl_autodemo_delete_keepmatches
Definition main.qh:33
bool autocvar_cl_autodemo_delete
Definition main.qh:32
void Spawn_Draw(entity this)
Definition spawnpoints.qc:8
bool autocvar_cl_spawn_event_sound
Definition spawnpoints.qh:4
bool autocvar_cl_spawn_point_particles
Definition spawnpoints.qh:5
bool autocvar_cl_spawn_event_particles
Definition spawnpoints.qh:3
float autocvar_cl_spawn_point_dist_max
Definition spawnpoints.qh:6
const vector PL_MIN_CONST
Definition constants.qh:56
const vector PL_MAX_CONST
Definition constants.qh:55
const float VF_ORIGIN
vector particles_colormin
float frametime
vector particles_colormax
float player_localentnum
vector absmax
float entnum
vector origin
vector absmin
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
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define NET_HANDLE(id, param)
Definition net.qh:15
#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
vector org
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
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8
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