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 entity eff = ReadRegistered(Effects);
13
14 vector vel = '0 0 0';
15 int eff_cnt = 1;
16 int eff_flags = 0;
17 bool eff_trail = eff.eent_eff_trail;
18 vector v = ReadVector();
19 int extraflags = ReadByte();
20
22
23 if(extraflags & EFF_NET_VELOCITY)
24 vel = ReadVector();
25
26 if(extraflags & EFF_NET_COLOR_MIN)
27 {
31 eff_flags |= PARTICLES_USECOLOR;
32 }
33
34 if(extraflags & EFF_NET_COLOR_MAX)
35 {
39 eff_flags |= PARTICLES_USECOLOR;
40 }
41 else if(extraflags & EFF_NET_COLOR_SAME)
43
44 if(!eff_trail)
45 eff_cnt = ReadByte();
46
47 if(eff_trail)
49 else
50 boxparticles(particleeffectnum(eff), NULL, v, v, vel, vel, 1, eff_flags);
51 return true;
52}
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:350
#define ReadRegistered(r)
Definition net.qh:291
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
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(), ReadRegistered, ReadVector, vector, and WarpZone_TrailParticles_WithMultiplier().

◆ Net_Write_Effect()

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

Definition at line 56 of file all.qc.

57{
58 int channel = MSG_ONE;
59 msg_entity = client;
60 WriteHeader(channel, net_effect);
61 WriteRegistered(Effects, channel, this);
62 WriteVector(channel, this.eent_net_location);
63
64 int extraflags = 0;
65 if(this.eent_net_velocity != '0 0 0')
66 extraflags |= EFF_NET_VELOCITY;
67 if(this.eent_net_color_min != '0 0 0')
68 extraflags |= EFF_NET_COLOR_MIN;
69 // optimisation: only send one color if the min and max match
70 if(this.eent_net_color_min != '0 0 0' && this.eent_net_color_min == this.eent_net_color_max)
71 extraflags |= EFF_NET_COLOR_SAME;
72 else if(this.eent_net_color_max != '0 0 0')
73 extraflags |= EFF_NET_COLOR_MAX;
74
75 WriteByte(channel, extraflags);
76
77 // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set
78 if(extraflags & EFF_NET_VELOCITY)
79 WriteVector(channel, this.eent_net_velocity);
80
81 if(extraflags & EFF_NET_COLOR_MIN)
82 {
83 vector col = this.eent_net_color_min;
84 WriteByte(channel, rint(bound(0, 16 * col.x, 255)));
85 WriteByte(channel, rint(bound(0, 16 * col.y, 255)));
86 WriteByte(channel, rint(bound(0, 16 * col.z, 255)));
87 }
88
89 if(extraflags & EFF_NET_COLOR_MAX)
90 {
91 vector col = this.eent_net_color_max;
92 WriteByte(channel, rint(bound(0, 16 * col.x, 255)));
93 WriteByte(channel, rint(bound(0, 16 * col.y, 255)));
94 WriteByte(channel, rint(bound(0, 16 * col.z, 255)));
95 }
96
97 if(!this.eent_eff_trail) { WriteByte(channel, this.eent_net_count); }
98 return true;
99}
vector eent_net_color_max
Definition effect.qh:26
vector eent_net_location
Definition effect.qh:23
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:265
#define WriteRegistered(r, to, it)
Definition net.qh:293
float MSG_ONE
Definition menudefs.qc:56
float bound(float min, float value, float max)
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(), msg_entity, MSG_ONE, rint(), vector, WriteByte(), WriteHeader, and WriteRegistered.

Referenced by Send_Effect_Except().

◆ Send_Effect()

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

Definition at line 120 of file all.qc.

121{
122 Send_Effect_Except(eff, eff_loc, eff_vel, eff_cnt, '0 0 0', '0 0 0', NULL);
123}
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:101

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 125 of file all.qc.

126{
127 // problem with this is, we might not have all the available effects for it
128 FOREACH(Effects, it.eent_eff_name == eff_name, {
129 Send_Effect(it, eff_loc, eff_vel, eff_cnt);
130 return;
131 });
132 // 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
133 __pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt);
134}
#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 101 of file all.qc.

102{
103 if(!eff) { return; }
104 if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count!
105 entity net_eff = new_pure(net_effect);
106 net_eff.owner = eff;
107 //net_eff.eent_broadcast = broadcast;
108 net_eff.m_id = eff.m_id;
109 net_eff.eent_net_velocity = eff_vel;
110 net_eff.eent_net_location = eff_loc;
111 net_eff.eent_net_count = eff_cnt;
112 net_eff.eent_eff_trail = eff.eent_eff_trail;
113 net_eff.eent_net_color_min = eff_col_min;
114 net_eff.eent_net_color_max = eff_col_max;
115
116 FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != ignore && !(IS_SPEC(it) && it.enemy && it.enemy == ignore), Net_Write_Effect(net_eff, it, 0));
117 delete(net_eff);
118}
bool Net_Write_Effect(entity this, entity client, int sf)
Definition all.qc:56
#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:52

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().