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

Go to the source code of this file.

Functions

bool pointparticles_SendEntity (entity this, entity to, float sendflags)
void pointparticles_think (entity this)
 spawnfunc (func_pointparticles)
 spawnfunc (func_sparks)

Function Documentation

◆ pointparticles_SendEntity()

bool pointparticles_SendEntity ( entity this,
entity to,
float sendflags )

Definition at line 7 of file pointparticles.qc.

8{
9 WriteHeader(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES);
10
11 // optional features to save space
12 sendflags &= 0x0F;
14 sendflags |= SF_POINTPARTICLES_IMPULSE; // absolute count on toggle-on
15 if(this.movedir != '0 0 0' || this.velocity != '0 0 0')
16 sendflags |= SF_POINTPARTICLES_MOVING; // 4 bytes - saves CPU
17 if(this.waterlevel || this.count != 1)
18 sendflags |= SF_POINTPARTICLES_JITTER_AND_COUNT; // 4 bytes - obscure features almost never used
19 if(this.mins != '0 0 0' || this.maxs != '0 0 0')
20 sendflags |= SF_POINTPARTICLES_BOUNDS; // 14 bytes - saves lots of space
21
22 WriteByte(MSG_ENTITY, sendflags);
23 if(sendflags & SF_TRIGGER_UPDATE)
24 {
25 if(this.active == ACTIVE_ACTIVE)
27 else
28 WriteCoord(MSG_ENTITY, 0); // off
29 }
30 if(sendflags & SF_TRIGGER_RESET)
31 {
32 WriteVector(MSG_ENTITY, this.origin);
33 }
34 if(sendflags & SF_TRIGGER_INIT)
35 {
36 if(this.model != "null")
37 {
39 if(sendflags & SF_POINTPARTICLES_BOUNDS)
40 {
41 WriteVector(MSG_ENTITY, this.mins);
42 WriteVector(MSG_ENTITY, this.maxs);
43 }
44 }
45 else
46 {
48 if(sendflags & SF_POINTPARTICLES_BOUNDS)
49 {
50 WriteVector(MSG_ENTITY, this.maxs);
51 }
52 }
55 if(sendflags & SF_POINTPARTICLES_MOVING)
56 {
59 }
61 {
62 WriteShort(MSG_ENTITY, this.waterlevel * 16.0);
63 WriteByte(MSG_ENTITY, this.count * 16.0);
64 }
66 if(this.noise != "")
67 {
68 WriteByte(MSG_ENTITY, floor(this.atten * 64));
69 WriteByte(MSG_ENTITY, floor(this.volume * 255));
70 }
71 WriteString(MSG_ENTITY, this.bgmscript);
72 if(this.bgmscript != "")
73 {
74 WriteByte(MSG_ENTITY, floor(this.bgmscriptattack * 64));
75 WriteByte(MSG_ENTITY, floor(this.bgmscriptdecay * 64));
76 WriteByte(MSG_ENTITY, floor(this.bgmscriptsustain * 255));
77 WriteByte(MSG_ENTITY, floor(this.bgmscriptrelease * 64));
78 }
79 }
80 return 1;
81}
float cnt
Definition powerups.qc:24
float count
Definition powerups.qc:22
int spawnflags
Definition ammo.qh:15
string mdl
Definition item.qh:89
float waterlevel
Definition player.qh:225
float compressShortVector(vector vec)
Definition util.qc:519
float modelindex
vector mins
vector velocity
vector maxs
vector origin
const int SF_TRIGGER_RESET
Definition defs.qh:24
const int SF_TRIGGER_INIT
Definition defs.qh:22
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
const int SF_TRIGGER_UPDATE
Definition defs.qh:23
WriteString(chan, ent.netname)
model
Definition ent_cs.qc:164
WriteByte(chan, ent.angles.y/DEC_FACTOR)
const int MSG_ENTITY
Definition net.qh:156
#define WriteHeader(to, id)
Definition net.qh:265
vector movedir
Definition viewloc.qh:18
void WriteShort(float data, float dest, float desto)
void WriteCoord(float data, float dest, float desto)
float floor(float f)
const int SF_POINTPARTICLES_IMPULSE
const int PARTICLES_IMPULSE
const int SF_POINTPARTICLES_BOUNDS
const int SF_POINTPARTICLES_MOVING
const int SF_POINTPARTICLES_JITTER_AND_COUNT
float impulse
Definition progsdefs.qc:158
string noise
Definition subs.qh:83
float volume
Definition triggers.qh:47
float atten
Definition triggers.qh:47

References active, ACTIVE_ACTIVE, atten, cnt, compressShortVector(), count, entity(), floor(), impulse, maxs, mdl, mins, model, modelindex, movedir, MSG_ENTITY, noise, origin, PARTICLES_IMPULSE, SF_POINTPARTICLES_BOUNDS, SF_POINTPARTICLES_IMPULSE, SF_POINTPARTICLES_JITTER_AND_COUNT, SF_POINTPARTICLES_MOVING, SF_TRIGGER_INIT, SF_TRIGGER_RESET, SF_TRIGGER_UPDATE, spawnflags, velocity, volume, waterlevel, WriteByte(), WriteCoord(), WriteHeader, WriteShort(), and WriteString().

Referenced by spawnfunc().

◆ pointparticles_think()

void pointparticles_think ( entity this)

Definition at line 83 of file pointparticles.qc.

84{
85 if(this.origin != this.oldorigin)
86 {
88 this.oldorigin = this.origin;
89 }
90 this.nextthink = time;
91}
float time
float nextthink
vector oldorigin
int SendFlags
Definition net.qh:159

References entity(), nextthink, oldorigin, origin, SendFlags, SF_TRIGGER_RESET, and time.

Referenced by spawnfunc().

◆ spawnfunc() [1/2]

spawnfunc ( func_pointparticles )

Definition at line 93 of file pointparticles.qc.

94{
95 if(this.model != "") { precache_model(this.model); _setmodel(this, this.model); }
96 if(this.noise != "") precache_sound(this.noise);
97 if(this.mdl != "") this.cnt = 0; // use a good handler
98
99 if(!this.bgmscriptsustain) this.bgmscriptsustain = 1;
100 else if(this.bgmscriptsustain < 0) this.bgmscriptsustain = 0;
101
102 if(!this.atten) this.atten = ATTEN_NORM;
103 else if(this.atten < 0) this.atten = 0;
104 if(!this.volume) this.volume = 1;
105 if(!this.count) this.count = 1;
106 if(!this.impulse) this.impulse = 1;
107
108 if(!this.modelindex)
109 {
110 setorigin(this, this.origin + this.mins);
111 setsize(this, '0 0 0', this.maxs - this.mins);
112 }
113 //if(!this.cnt) this.cnt = _particleeffectnum(this.mdl);
114 this.setactive = generic_netlinked_setactive;
115
117
118 if(this.targetname && this.targetname != "")
119 {
120 // backwards compatibility
122 }
123 this.reset = generic_netlinked_reset;
124 this.reset(this);
126 this.nextthink = time;
127}
#define use
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:167
string precache_sound(string sample)
void pointparticles_think(entity this)
bool pointparticles_SendEntity(entity this, entity to, float sendflags)
const int PARTICLES_VISCULLING
#define setthink(e, f)
const float ATTEN_NORM
Definition sound.qh:30
void generic_netlinked_reset(entity this)
Definition triggers.qc:76
void generic_netlinked_legacy_use(entity this, entity actor, entity trigger)
Definition triggers.qc:98
void generic_netlinked_setactive(entity this, int act)
Definition triggers.qc:65
string targetname
Definition triggers.qh:56

References atten, ATTEN_NORM, cnt, count, generic_netlinked_legacy_use(), generic_netlinked_reset(), generic_netlinked_setactive(), impulse, maxs, mdl, mins, model, modelindex, Net_LinkEntity(), nextthink, noise, origin, PARTICLES_VISCULLING, pointparticles_SendEntity(), pointparticles_think(), precache_sound(), setthink, spawnflags, targetname, time, use, and volume.

◆ spawnfunc() [2/2]

spawnfunc ( func_sparks )

Definition at line 129 of file pointparticles.qc.

130{
131 if(this.count < 1) {
132 this.count = 25.0; // nice default value
133 }
134
135 if(this.impulse < 0.5) {
136 this.impulse = 2.5; // nice default value
137 }
138
139 this.mins = '0 0 0';
140 this.maxs = '0 0 0';
141 this.velocity = '0 0 -1';
142 this.mdl = "TE_SPARK";
143 this.cnt = 0; // use mdl
144
145 spawnfunc_func_pointparticles(this);
146}

References cnt, count, impulse, maxs, mdl, mins, and velocity.