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

Go to the source code of this file.

Functions

 NET_HANDLE (net_effect, bool isNew)
bool Net_Write_Effect (entity this, entity client, int sf)
void Send_Effect (entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
void Send_Effect_ (string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
void Send_Effect_Except (entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, entity ignore)

Variables

const int EFF_NET_COLOR_MAX = BIT(2)
const int EFF_NET_COLOR_MIN = BIT(1)
const int EFF_NET_COLOR_SAME = BIT(3)
const int EFF_NET_VELOCITY = BIT(0)

Function Documentation

◆ NET_HANDLE()

NET_HANDLE ( net_effect ,
bool isNew )

Definition at line 10 of file all.qc.

11{
12 int net_name = (REGISTRY_COUNT(Effects) >= 255) ? ReadShort() : ReadByte();
13
14 entity eff = REGISTRY_GET(Effects, net_name);
15
16 vector vel = '0 0 0';
17 int eff_cnt = 1;
18 int eff_flags = 0;
19 bool eff_trail = eff.eent_eff_trail;
20 vector v = ReadVector();
21 int extraflags = ReadByte();
22
24
25 if(extraflags & EFF_NET_VELOCITY)
26 vel = ReadVector();
27
28 if(extraflags & EFF_NET_COLOR_MIN)
29 {
33 eff_flags |= PARTICLES_USECOLOR;
34 }
35
36 if(extraflags & EFF_NET_COLOR_MAX)
37 {
41 eff_flags |= PARTICLES_USECOLOR;
42 }
43 else if(extraflags & EFF_NET_COLOR_SAME)
45
46 if(!eff_trail)
47 eff_cnt = ReadByte();
48
49 if(eff_trail)
51 else
52 boxparticles(particleeffectnum(eff), NULL, v, v, vel, vel, 1, eff_flags);
53 return true;
54}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
vector particles_colormin
vector particles_colormax
float PARTICLES_USECOLOR
#define particleeffectnum(e)
Definition effect.qh:3
const int EFF_NET_COLOR_MIN
Definition all.qc:4
const int EFF_NET_COLOR_SAME
Definition all.qc:6
const int EFF_NET_VELOCITY
Definition all.qc:3
const int EFF_NET_COLOR_MAX
Definition all.qc:5
#define ReadVector()
Definition net.qh:367
int ReadByte()
void WarpZone_TrailParticles_WithMultiplier(entity own, float eff, vector org, vector end, float f, int boxflags)
Definition common.qc:489
#define NULL
Definition post.qh:14
#define REGISTRY_COUNT(id)
Definition registry.qh:18
#define REGISTRY_GET(id, i)
Definition registry.qh:43
vector
Definition self.qh:92

References EFF_NET_COLOR_MAX, EFF_NET_COLOR_MIN, EFF_NET_COLOR_SAME, EFF_NET_VELOCITY, entity(), NULL, particleeffectnum, particles_colormax, particles_colormin, PARTICLES_USECOLOR, ReadByte(), ReadVector, REGISTRY_COUNT, REGISTRY_GET, vector, and WarpZone_TrailParticles_WithMultiplier().

◆ Net_Write_Effect()

bool Net_Write_Effect ( entity this,
entity client,
int sf )

Definition at line 58 of file all.qc.

59{
60 int channel = MSG_ONE;
61 msg_entity = client;
62 WriteHeader(channel, net_effect);
63 (REGISTRY_COUNT(Effects) >= 255)
64 ? WriteShort(channel, this.m_id)
65 : WriteByte(channel, this.m_id);
66 WriteVector(channel, this.eent_net_location);
67
68 int extraflags = 0;
69 if(this.eent_net_velocity != '0 0 0')
70 extraflags |= EFF_NET_VELOCITY;
71 if(this.eent_net_color_min != '0 0 0')
72 extraflags |= EFF_NET_COLOR_MIN;
73 // optimisation: only send one color if the min and max match
74 if(this.eent_net_color_min != '0 0 0' && this.eent_net_color_min == this.eent_net_color_max)
75 extraflags |= EFF_NET_COLOR_SAME;
76 else if(this.eent_net_color_max != '0 0 0')
77 extraflags |= EFF_NET_COLOR_MAX;
78
79 WriteByte(channel, extraflags);
80
81 // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set
82 if(extraflags & EFF_NET_VELOCITY)
83 WriteVector(channel, this.eent_net_velocity);
84
85 if(extraflags & EFF_NET_COLOR_MIN)
86 {
87 vector col = this.eent_net_color_min;
88 WriteByte(channel, rint(bound(0, 16 * col.x, 255)));
89 WriteByte(channel, rint(bound(0, 16 * col.y, 255)));
90 WriteByte(channel, rint(bound(0, 16 * col.z, 255)));
91 }
92
93 if(extraflags & EFF_NET_COLOR_MAX)
94 {
95 vector col = this.eent_net_color_max;
96 WriteByte(channel, rint(bound(0, 16 * col.x, 255)));
97 WriteByte(channel, rint(bound(0, 16 * col.y, 255)));
98 WriteByte(channel, rint(bound(0, 16 * col.z, 255)));
99 }
100
101 if(!this.eent_eff_trail) { WriteByte(channel, this.eent_net_count); }
102 return true;
103}
vector eent_net_color_max
Definition effect.qh:26
vector eent_net_location
Definition effect.qh:23
int m_id
Definition effect.qh:19
int eent_eff_trail
Definition effect.qh:21
vector eent_net_color_min
Definition effect.qh:25
vector eent_net_velocity
Definition effect.qh:24
int eent_net_count
Definition effect.qh:27
#define WriteHeader(to, id)
Definition net.qh:221
float MSG_ONE
Definition menudefs.qc:56
float bound(float min, float value, float max)
void WriteShort(float data, float dest, float desto)
float rint(float f)
void WriteByte(float data, float dest, float desto)
entity msg_entity
Definition progsdefs.qc:63

References bound(), eent_eff_trail, eent_net_color_max, eent_net_color_min, eent_net_count, eent_net_location, eent_net_velocity, EFF_NET_COLOR_MAX, EFF_NET_COLOR_MIN, EFF_NET_COLOR_SAME, EFF_NET_VELOCITY, entity(), m_id, msg_entity, MSG_ONE, REGISTRY_COUNT, rint(), vector, WriteByte(), WriteHeader, and WriteShort().

Referenced by Send_Effect_Except().

◆ Send_Effect()

void Send_Effect ( entity eff,
vector eff_loc,
vector eff_vel,
int eff_cnt )

Definition at line 124 of file all.qc.

125{
126 Send_Effect_Except(eff, eff_loc, eff_vel, eff_cnt, '0 0 0', '0 0 0', NULL);
127}
void Send_Effect_Except(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, entity ignore)
Definition all.qc:105

References entity(), NULL, Send_Effect_Except(), and vector.

Referenced by Arc_Smoke(), buff_Respawn(), buff_Think(), buff_Touch(), bumblebee_blowup(), bumblebee_diethink(), CheatImpulse(), ClientDisconnect(), GrapplingHook_Stop(), jumppad_push(), ka_RespawnBall(), ka_TouchEvent(), kh_WinnerTeam(), M_Golem_Attack_Lightning_Explode(), M_Golem_Attack_Smash(), M_Mage_Attack_Push(), M_Mage_Attack_Spike_Explode(), M_Mage_Attack_Teleport(), M_Mage_Defend_Heal(), M_Spider_Attack_Web_Explode(), M_Wyvern_Attack_Fireball_Explode(), Monster_Remove(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), nade_ammo_touch(), nade_darkness_think(), nade_heal_touch(), nade_ice_freeze(), nade_ice_think(), napalm_damage(), ons_ControlPoint_Icon_BuildThink(), ons_ControlPoint_Icon_Spawn(), ons_ControlPoint_Icon_Think(), ons_GeneratorDamage(), ons_Teleport(), PlayerDamage(), PlayerTouchExplode(), Portal_Remove(), PutObserverInServer(), raptor_diethink(), respawn(), spiderbot_blowup(), spiderbot_frame(), spiderbot_headfade(), TeleportPlayer(), tka_RespawnBall(), tka_TouchEvent(), turret_die(), vehicles_gib_explode(), vehicles_painframe(), vehicles_projectile(), vehicles_return(), vehicles_spawn(), W_Arc_Beam_Think(), W_Arc_Bolt_Touch(), W_Crylink_LinkJoinEffect_Think(), W_Devastator_Think(), W_Fireball_AttackEffect(), W_Fireball_Explode(), W_Fireball_LaserPlay(), W_Hagar_Touch2(), W_Mortar_Grenade_Touch1(), W_Mortar_Grenade_Touch2(), W_Shotgun_Melee_Think(), and W_Tuba_NoteOn().

◆ Send_Effect_()

void Send_Effect_ ( string eff_name,
vector eff_loc,
vector eff_vel,
int eff_cnt )

Definition at line 129 of file all.qc.

130{
131 // problem with this is, we might not have all the available effects for it
132 FOREACH(Effects, it.eent_eff_name == eff_name, {
133 Send_Effect(it, eff_loc, eff_vel, eff_cnt);
134 return;
135 });
136 // revert to engine handling TODO: send the effect name and draw it on the client side? not as light on networking, but resolves the use of server side effects
137 __pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt);
138}
#define FOREACH(list, cond, body)
Definition iter.qh:19

References FOREACH, and vector.

Referenced by buff_Effect(), CheatCommand(), ctf_Handle_Capture(), ctf_Handle_Pickup(), and sandbox_ObjectFunction_Touch().

◆ Send_Effect_Except()

void Send_Effect_Except ( entity eff,
vector eff_loc,
vector eff_vel,
int eff_cnt,
vector eff_col_min,
vector eff_col_max,
entity ignore )

Definition at line 105 of file all.qc.

106{
107 if(!eff) { return; }
108 if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count!
109 entity net_eff = new_pure(net_effect);
110 net_eff.owner = eff;
111 //net_eff.eent_broadcast = broadcast;
112 net_eff.m_id = eff.m_id;
113 net_eff.eent_net_velocity = eff_vel;
114 net_eff.eent_net_location = eff_loc;
115 net_eff.eent_net_count = eff_cnt;
116 net_eff.eent_eff_trail = eff.eent_eff_trail;
117 net_eff.eent_net_color_min = eff_col_min;
118 net_eff.eent_net_color_max = eff_col_max;
119
120 FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != ignore && !(IS_SPEC(it) && it.enemy && it.enemy == ignore), Net_Write_Effect(net_eff, it, 0));
121 delete(net_eff);
122}
bool Net_Write_Effect(entity this, entity client, int sf)
Definition all.qc:58
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67
#define IS_SPEC(v)
Definition utils.qh:10
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50

References entity(), FOREACH_CLIENT, IS_REAL_CLIENT, IS_SPEC, Net_Write_Effect(), new_pure, and vector.

Referenced by nade_boom(), nade_darkness_think(), nade_ice_think(), Send_Effect(), and W_MuzzleFlash().

Variable Documentation

◆ EFF_NET_COLOR_MAX

const int EFF_NET_COLOR_MAX = BIT(2)

Definition at line 5 of file all.qc.

Referenced by NET_HANDLE(), and Net_Write_Effect().

◆ EFF_NET_COLOR_MIN

const int EFF_NET_COLOR_MIN = BIT(1)

Definition at line 4 of file all.qc.

Referenced by NET_HANDLE(), and Net_Write_Effect().

◆ EFF_NET_COLOR_SAME

const int EFF_NET_COLOR_SAME = BIT(3)

Definition at line 6 of file all.qc.

Referenced by NET_HANDLE(), and Net_Write_Effect().

◆ EFF_NET_VELOCITY

const int EFF_NET_VELOCITY = BIT(0)

Definition at line 3 of file all.qc.

Referenced by NET_HANDLE(), and Net_Write_Effect().