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

Go to the source code of this file.

Macros

#define EFFECT(istrail, name, realname)

Functions

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_Core (entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, float eff_alpha_min, float eff_alpha_max, float eff_alpha_fade, entity ignore)

Macro Definition Documentation

◆ EFFECT

#define EFFECT ( istrail,
name,
realname )
Value:
REGISTER(Effects, EFFECT, name, m_id, Create_Effect_Entity(realname, istrail));
entity Create_Effect_Entity(string eff_name, bool eff_trail)
Definition effect.qh:22
int m_id
Definition effect.qh:18
#define EFFECT(istrail, name, realname)
Definition all.qh:14
string name
Definition menu.qh:30
#define REGISTER(...)
Register a new entity with a registry.
Definition registry.qh:121

Definition at line 14 of file all.qh.

14#define EFFECT(istrail, name, realname) \
15 REGISTER(Effects, EFFECT, name, m_id, Create_Effect_Entity(realname, istrail));

Function Documentation

◆ Send_Effect()

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

Definition at line 155 of file all.qc.

156{
157 Send_Effect_Core(eff, eff_loc, eff_vel, eff_cnt, '0 0 0', '0 0 0', -1, -1, -1, NULL);
158}
void Send_Effect_Core(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, float eff_alpha_min, float eff_alpha_max, float eff_alpha_fade, entity ignore)
Definition all.qc:74
#define NULL
Definition post.qh:14

References entity(), NULL, Send_Effect_Core(), 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_darkness_think(), 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 160 of file all.qc.

161{
162 // problem with this is, we might not have all the available effects for it
163 FOREACH(Effects, it.eent_eff_name == eff_name,
164 {
165 Send_Effect(it, eff_loc, eff_vel, eff_cnt);
166 return;
167 });
168 // 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
169 __pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt);
170}
#define FOREACH(list, cond, body)
Definition iter.qh:19

References FOREACH, and vector.

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

◆ Send_Effect_Core()

void Send_Effect_Core ( entity eff,
vector eff_loc,
vector eff_vel,
int eff_cnt,
vector eff_col_min,
vector eff_col_max,
float eff_alpha_min,
float eff_alpha_max,
float eff_alpha_fade,
entity ignore )

Definition at line 74 of file all.qc.

75{
76 if (!eff
77 || (!eff.eent_eff_trail && !eff_cnt)) // effect has no count
78 return;
79
80 int sf = 0;
81 if (eff_vel != '0 0 0')
82 sf |= SF_EFF_VELOCITY;
83
84 // if only one of min or max is set, that color is used for both
85 if (eff_col_min != '0 0 0')
86 {
87 sf |= SF_EFF_COLOR_MIN;
88 eff_col_min.x = rint(bound(0, 16 * eff_col_min.x, BITS(8)));
89 eff_col_min.y = rint(bound(0, 16 * eff_col_min.y, BITS(8)));
90 eff_col_min.z = rint(bound(0, 16 * eff_col_min.z, BITS(8)));
91 }
92 if (eff_col_max != '0 0 0'
93 && eff_col_min != eff_col_max) // optimization: only send one color if the min and max match
94 {
95 sf |= SF_EFF_COLOR_MAX;
96 eff_col_max.x = rint(bound(0, 16 * eff_col_max.x, BITS(8)));
97 eff_col_max.y = rint(bound(0, 16 * eff_col_max.y, BITS(8)));
98 eff_col_max.z = rint(bound(0, 16 * eff_col_max.z, BITS(8)));
99 }
100
101 if (eff_alpha_min >= 0)
102 {
103 sf |= SF_EFF_ALPHA_MIN;
104 eff_alpha_min = rint(bound(0, eff_alpha_min, 1) * BITS(8));
105 }
106 if (eff_alpha_max >= 0
107 && eff_alpha_min != eff_alpha_max) // optimization: only send one alpha if the min and max match
108 {
109 sf |= SF_EFF_ALPHA_MAX;
110 eff_alpha_max = rint(bound(0, eff_alpha_max, 1) * BITS(8));
111 }
112 if (eff_alpha_fade >= 0)
113 {
114 sf |= SF_EFF_FADE;
115 eff_alpha_fade = rint(bound(0, eff_alpha_fade, 1) * BITS(8));
116 }
117
118 // now network to every client
119 FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != ignore && !(IS_SPEC(it) && it.enemy && it.enemy == ignore),
120 {
121 msg_entity = it;
122 WriteHeader(MSG_ONE, net_effect);
123 WriteByte(MSG_ONE, sf);
124 WriteRegistered(Effects, MSG_ONE, eff);
125 WriteVector(MSG_ONE, eff_loc);
126
127 // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set
128 if (sf & SF_EFF_VELOCITY)
129 WriteVector(MSG_ONE, eff_vel);
130
131 if (sf & SF_EFF_COLOR_MIN)
132 {
133 WriteByte(MSG_ONE, eff_col_min.x);
134 WriteByte(MSG_ONE, eff_col_min.y);
135 WriteByte(MSG_ONE, eff_col_min.z);
136 }
137 if (sf & SF_EFF_COLOR_MAX)
138 {
139 WriteByte(MSG_ONE, eff_col_max.x);
140 WriteByte(MSG_ONE, eff_col_max.y);
141 WriteByte(MSG_ONE, eff_col_max.z);
142 }
143
144 if (sf & SF_EFF_ALPHA_MIN)
145 WriteByte(MSG_ONE, eff_alpha_min);
146 if (sf & SF_EFF_ALPHA_MAX)
147 WriteByte(MSG_ONE, eff_alpha_max);
148 if (sf & SF_EFF_FADE)
149 WriteByte(MSG_ONE, eff_alpha_fade);
150
151 WriteByte(MSG_ONE, eff_cnt);
152 });
153}
#define BITS(n)
Definition bits.qh:9
const int SF_EFF_FADE
Definition all.qc:9
const int SF_EFF_ALPHA_MIN
Definition all.qc:7
const int SF_EFF_COLOR_MIN
Definition all.qc:5
const int SF_EFF_VELOCITY
Definition all.qc:4
const int SF_EFF_COLOR_MAX
Definition all.qc:6
const int SF_EFF_ALPHA_MAX
Definition all.qc:8
WriteByte(chan, ent.angles.y/DEC_FACTOR)
float MSG_ONE
Definition menudefs.qc:56
float bound(float min, float value, float max)
float rint(float f)
if(frag_attacker.flagcarried)
Definition sv_ctf.qc:2319
#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 BITS, bound(), entity(), FOREACH_CLIENT, if(), IS_REAL_CLIENT, IS_SPEC, MSG_ONE, rint(), SF_EFF_ALPHA_MAX, SF_EFF_ALPHA_MIN, SF_EFF_COLOR_MAX, SF_EFF_COLOR_MIN, SF_EFF_FADE, SF_EFF_VELOCITY, vector, and WriteByte().

Referenced by buff_Effect(), dompoint_captured(), M_Mage_Defend_Heal(), MUTATOR_HOOKFUNCTION(), nade_boom(), nade_darkness_think(), nade_ice_think(), Send_Effect(), and W_MuzzleFlash().