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

Go to the source code of this file.

Functions

 REPLICATE_INIT (bool, cvar_cl_casings)
 REPLICATE_INIT (int, cvar_r_drawviewmodel)
void SpawnCasing (vector vel, vector ang, int casingtype, entity casingowner,.entity weaponentity)

Variables

float autocvar_cl_casings_bronze_time
int autocvar_cl_casings_maxcount = 100
float autocvar_cl_casings_shell_time
bool autocvar_cl_casings_sloppy = 1
float autocvar_cl_casings_ticrate
int autocvar_g_casings

Function Documentation

◆ REPLICATE_INIT() [1/2]

REPLICATE_INIT ( bool ,
cvar_cl_casings  )

◆ REPLICATE_INIT() [2/2]

REPLICATE_INIT ( int ,
cvar_r_drawviewmodel  )

◆ SpawnCasing()

void SpawnCasing ( vector vel,
vector ang,
int casingtype,
entity casingowner,
.entity weaponentity )

Definition at line 17 of file casings.qc.

18{
19 vector org = casingowner.(weaponentity).spawnorigin;
20 org = casingowner.origin + casingowner.view_ofs + org.x * v_forward - org.y * v_right + org.z * v_up;
21
22 FOREACH_CLIENT(true, {
23 if (!(CS_CVAR(it).cvar_cl_casings))
24 continue;
25
26 casingtype &= 0x3F; // reset any bitflags that were set for the previous client
27
28 if (it == casingowner || (IS_SPEC(it) && it.enemy == casingowner))
29 {
30 if (!(CS_CVAR(it).cvar_r_drawviewmodel))
31 continue;
32
33 casingtype |= 0x40; // client will apply autocvar_cl_gunoffset in first person
34 }
35 else if (1 & ~checkpvs(it.origin + it.view_ofs, casingowner)) // 1 or 3 means visible
36 continue;
37
38 msg_entity = it; // sound_allowed checks this
39 if (!sound_allowed(MSG_ONE, it))
40 casingtype |= 0x80; // silent
41
42 WriteHeader(MSG_ONE, casings);
43 WriteByte(MSG_ONE, casingtype);
44 WriteVector(MSG_ONE, org);
45 WriteShort(MSG_ONE, compressShortVector(vel)); // actually compressed velocity
46 WriteByte(MSG_ONE, ang.x * 256 / 360);
47 WriteByte(MSG_ONE, ang.y * 256 / 360);
48 // weapons only have pitch and yaw, so no need to send ang.z
49 });
50}
float compressShortVector(vector vec)
Definition util.qc:521
vector v_up
vector v_right
float checkpvs(vector viewpos, entity viewee)
vector v_forward
#define WriteHeader(to, id)
Definition net.qh:221
float MSG_ONE
Definition menudefs.qc:56
void WriteShort(float data, float dest, float desto)
void WriteByte(float data, float dest, float desto)
entity msg_entity
Definition progsdefs.qc:63
vector
Definition self.qh:92
vector org
Definition self.qh:92
vector vector ang
Definition self.qh:92
bool sound_allowed(int to, entity e)
Definition all.qc:9
#define CS_CVAR(this)
Definition state.qh:51
#define IS_SPEC(v)
Definition utils.qh:10
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50
vector spawnorigin
Definition all.qh:391

References ang, checkpvs(), compressShortVector(), CS_CVAR, entity(), FOREACH_CLIENT, IS_SPEC, msg_entity, MSG_ONE, org, sound_allowed(), spawnorigin, v_forward, v_right, v_up, vector, WriteByte(), WriteHeader, and WriteShort().

Referenced by W_MachineGun_Attack(), W_MachineGun_Attack_Auto(), W_MachineGun_Attack_Burst(), W_OverkillHeavyMachineGun_Attack_Auto(), W_OverkillMachineGun_Attack_Auto(), W_Rifle_FireBullet(), and W_Shotgun_Attack().

Variable Documentation

◆ autocvar_cl_casings_bronze_time

float autocvar_cl_casings_bronze_time

Definition at line 4 of file casings.qh.

Referenced by NET_HANDLE().

◆ autocvar_cl_casings_maxcount

int autocvar_cl_casings_maxcount = 100

Definition at line 5 of file casings.qh.

Referenced by NET_HANDLE().

◆ autocvar_cl_casings_shell_time

float autocvar_cl_casings_shell_time

Definition at line 6 of file casings.qh.

Referenced by NET_HANDLE().

◆ autocvar_cl_casings_sloppy

bool autocvar_cl_casings_sloppy = 1

Definition at line 7 of file casings.qh.

Referenced by Casing_Draw().

◆ autocvar_cl_casings_ticrate

float autocvar_cl_casings_ticrate

Definition at line 8 of file casings.qh.

Referenced by Casing_Draw().

◆ autocvar_g_casings