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
8
void
Spawn_Draw
(
entity
this
)
9
{
10
bool
dodraw =
autocvar_cl_spawn_point_particles
;
11
if
(dodraw &&
autocvar_cl_spawn_point_dist_max
)
12
{
13
vector
org
= getpropertyvec(
VF_ORIGIN
);
14
dodraw =
vdist
(
org
- this.
origin
, <,
autocvar_cl_spawn_point_dist_max
);
15
}
16
17
if
(dodraw)
18
{
19
particles_colormin
=
particles_colormax
=
Team_ColorRGB
(this.
team
- 1);
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
24
NET_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
40
NET_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);
59
particles_colormin
=
particles_colormax
= tcolor;
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
{
74
if
(!
spectatee_status
)
75
if
(
autocvar_cl_autodemo_delete_keepmatches
>= 2 || (!
warmup_stage
&&
autocvar_cl_autodemo_delete_keepmatches
== 1))
76
{
77
float
del =
autocvar_cl_autodemo_delete
;
78
del &= ~1;
79
cvar_set
(
"cl_autodemo_delete"
,
ftos
(del));
// don't delete demo where the player joined the match
80
}
81
82
if
(
autocvar_cl_spawnzoom
&& !
autocvar_cl_lockview
)
83
{
84
zoomin_effect
= 1;
85
current_viewzoom
= (1 /
bound
(1,
autocvar_cl_spawnzoom_factor
, 16));
86
}
87
88
if
(
autocvar_cl_unpress_zoom_on_spawn
)
89
{
90
localcmd
(
"-zoom\n"
);
91
button_zoom
=
false
;
92
}
93
HUD_Radar_Hide_Maximized
();
94
}
95
}
BIT
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition
bits.qh:8
entity
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
main.qh
zoomin_effect
float zoomin_effect
Definition
main.qh:119
current_viewzoom
float current_viewzoom
Definition
main.qh:118
g_drawables
IntrusiveList g_drawables
Definition
main.qh:91
button_zoom
bool button_zoom
Definition
main.qh:113
spectatee_status
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
Definition
main.qh:197
autocvar_cl_unpress_zoom_on_spawn
bool autocvar_cl_unpress_zoom_on_spawn
Definition
main.qh:7
warmup_stage
bool warmup_stage
Definition
main.qh:120
team
int team
Definition
main.qh:188
autocvar_cl_autodemo_delete_keepmatches
bool autocvar_cl_autodemo_delete_keepmatches
Definition
main.qh:33
autocvar_cl_autodemo_delete
bool autocvar_cl_autodemo_delete
Definition
main.qh:32
Spawn_Draw
void Spawn_Draw(entity this)
Definition
spawnpoints.qc:8
spawnpoints.qh
autocvar_cl_spawn_event_sound
bool autocvar_cl_spawn_event_sound
Definition
spawnpoints.qh:4
autocvar_cl_spawn_point_particles
bool autocvar_cl_spawn_point_particles
Definition
spawnpoints.qh:5
autocvar_cl_spawn_event_particles
bool autocvar_cl_spawn_event_particles
Definition
spawnpoints.qh:3
autocvar_cl_spawn_point_dist_max
float autocvar_cl_spawn_point_dist_max
Definition
spawnpoints.qh:6
PL_MIN_CONST
const vector PL_MIN_CONST
Definition
constants.qh:56
PL_MAX_CONST
const vector PL_MAX_CONST
Definition
constants.qh:55
VF_ORIGIN
const float VF_ORIGIN
Definition
csprogsdefs.qc:186
particles_colormin
vector particles_colormin
Definition
csprogsdefs.qc:1495
frametime
float frametime
Definition
csprogsdefs.qc:17
particles_colormax
vector particles_colormax
Definition
csprogsdefs.qc:1495
player_localentnum
float player_localentnum
Definition
csprogsdefs.qc:19
absmax
vector absmax
Definition
csprogsdefs.qc:96
entnum
float entnum
Definition
csprogsdefs.qc:98
origin
vector origin
Definition
csprogsdefs.qc:105
absmin
vector absmin
Definition
csprogsdefs.qc:96
PARTICLES_USECOLOR
float PARTICLES_USECOLOR
Definition
csprogsdefs.qc:1494
particleeffectnum
#define particleeffectnum(e)
Definition
effect.qh:3
ent_cs.qh
entcs_GetColor
vector entcs_GetColor(int i)
Definition
ent_cs.qh:176
hud.qh
HUD_Radar_Hide_Maximized
void HUD_Radar_Hide_Maximized()
Definition
radar.qc:51
IL_PUSH
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
Definition
intrusivelist.qh:61
NET_HANDLE
#define NET_HANDLE(id, param)
Definition
net.qh:15
ReadVector
#define ReadVector()
Definition
net.qh:367
ReadByte
int ReadByte()
localcmd
void localcmd(string command,...)
cvar_set
void cvar_set(string name, string value)
bound
float bound(float min, float value, float max)
ftos
string ftos(float f)
vector
vector
Definition
self.qh:92
org
vector org
Definition
self.qh:92
CH_TRIGGER
const int CH_TRIGGER
Definition
sound.qh:12
VOL_BASE
const float VOL_BASE
Definition
sound.qh:36
ATTEN_NORM
const float ATTEN_NORM
Definition
sound.qh:30
sound
#define sound(e, c, s, v, a)
Definition
sound.qh:52
Team_ColorRGB
vector Team_ColorRGB(int teamid)
Definition
teams.qh:76
teamplay
bool teamplay
Definition
teams.qh:59
vdist
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition
vector.qh:8
view.qh
autocvar_cl_spawnzoom_factor
float autocvar_cl_spawnzoom_factor
Definition
view.qh:25
autocvar_cl_lockview
bool autocvar_cl_lockview
Definition
view.qh:20
autocvar_cl_spawnzoom
bool autocvar_cl_spawnzoom
Definition
view.qh:23
client
spawnpoints.qc
Generated on
for Xonotic QuakeC by
1.14.0