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

Go to the source code of this file.

Functions

void CSQCProjectile (entity e, float clientanimate, int type, float docull)
void CSQCProjectile_Check (entity e)
bool CSQCProjectile_SendEntity (entity this, entity to, int sf)
void UpdateCSQCProjectile (entity e)
void UpdateCSQCProjectileAfterTeleport (entity e)

Variables

vector csqcprojectile_oldorigin
float csqcprojectile_type

Function Documentation

◆ CSQCProjectile()

void CSQCProjectile ( entity e,
float clientanimate,
int type,
float docull )

Definition at line 80 of file csqcprojectile.qc.

81{
83
84 e.csqcprojectile_clientanimate = clientanimate;
85
86 if(e.move_movetype == MOVETYPE_TOSS || e.move_movetype == MOVETYPE_BOUNCE)
87 {
88 if(e.gravity == 0)
89 e.gravity = 1;
90 }
91 else
92 e.gravity = 0;
93
95 type |= 0x80;
96 e.csqcprojectile_type = type;
97}
bool CSQCProjectile_SendEntity(entity this, entity to, int sf)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
float MSG_BROADCAST
Definition menudefs.qc:55
const int MOVETYPE_TOSS
Definition movetypes.qh:135
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
bool sound_allowed(int to, entity e)
Definition all.qc:9

References CSQCProjectile_SendEntity(), entity(), MOVETYPE_BOUNCE, MOVETYPE_TOSS, MSG_BROADCAST, Net_LinkEntity(), and sound_allowed().

Referenced by M_Golem_Attack_Lightning(), M_Mage_Attack_Spike(), M_Spider_Attack_Web(), nade_burn_spawn(), nade_napalm_boom(), nade_spawn(), raptor_bomb_burst(), raptor_bombdrop(), turret_projectile(), vehicles_projectile(), W_Arc_Attack_Bolt(), W_Blaster_Think(), W_Crylink_Attack(), W_Crylink_Attack2(), W_Devastator_Attack(), W_Electro_Attack_Bolt(), W_Electro_Attack_Orb(), W_Fireball_Attack1(), W_Fireball_Attack2(), W_Hagar_Attack(), W_Hagar_Attack2(), W_Hagar_Attack2_Load_Release(), W_HLAC_Attack(), W_HLAC_Attack2(), W_Hook_Attack2(), W_MineLayer_Attack(), W_Mortar_Attack(), W_Mortar_Attack2(), W_Nexball_Attack2(), W_OverkillRocketPropelledChainsaw_Attack(), W_Porto_Attack(), W_Porto_Touch(), W_RocketMinsta_Attack(), W_Seeker_Fire_Flac(), W_Seeker_Fire_Missile(), W_Seeker_Fire_Tag(), and walker_fire_rocket().

◆ CSQCProjectile_Check()

void CSQCProjectile_Check ( entity e)

Definition at line 71 of file csqcprojectile.qc.

72{
73 if(e.csqcprojectile_clientanimate)
74 if(IS_ONGROUND(e))
75 if(e.origin != e.csqcprojectile_oldorigin)
77 e.csqcprojectile_oldorigin = e.origin;
78}
void UpdateCSQCProjectile(entity e)
#define IS_ONGROUND(s)
Definition movetypes.qh:16

References entity(), IS_ONGROUND, and UpdateCSQCProjectile().

Referenced by StartFrame().

◆ CSQCProjectile_SendEntity()

bool CSQCProjectile_SendEntity ( entity this,
entity to,
int sf )

Definition at line 13 of file csqcprojectile.qc.

14{
15 float ft, fr;
16
17 // note: flag 0x08 = no trail please (teleport bit)
18 sf = sf & 0x0F;
19
21 sf |= 0x80; // client animated, not interpolated
22
23 if(IS_ONGROUND(this))
24 sf |= 0x40;
25
26 ft = fr = 0;
27 if(this.fade_time != 0 || this.fade_rate != 0)
28 {
29 ft = (this.fade_time - time) / sys_frametime;
30 fr = (1 / this.fade_rate) / sys_frametime;
31 if(ft <= 255 && fr <= 255 && fr >= 1)
32 sf |= 0x20;
33 }
34
35 if(this.gravity != 0)
36 sf |= 0x10;
37
38 WriteHeader(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
40
41 if(sf & 1)
42 {
43 WriteVector(MSG_ENTITY, this.origin);
44
45 if(sf & 0x80)
46 {
47 WriteVector(MSG_ENTITY, this.velocity);
48 if(sf & 0x10)
50 }
51
52 if(sf & 0x20)
53 {
56 }
57
58 if(teamplay)
59 WriteByte(MSG_ENTITY, this.realowner.team);
60 else
61 WriteByte(MSG_ENTITY, this.realowner.clientcolors); // NOTE: doesn't work on non-clients
62 }
63
64 if(sf & 2)
65 WriteByte(MSG_ENTITY, this.csqcprojectile_type); // TODO maybe put this into sf?
66
67 return true;
68}
float gravity
Definition items.qh:17
vector velocity
float time
vector origin
float csqcprojectile_type
float csqcprojectile_clientanimate
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
void WriteCoord(float data, float dest, float desto)
void WriteByte(float data, float dest, float desto)
fade_rate
Definition projectile.qh:14
float sys_frametime
Definition common.qh:57
float fade_time
Definition common.qh:23
bool teamplay
Definition teams.qh:59
entity realowner

References csqcprojectile_clientanimate, csqcprojectile_type, entity(), fade_rate, fade_time, gravity, IS_ONGROUND, MSG_ENTITY, origin, realowner, sys_frametime, teamplay, time, velocity, WriteByte(), WriteCoord(), and WriteHeader.

Referenced by CSQCProjectile(), UpdateCSQCProjectile(), and UpdateCSQCProjectileAfterTeleport().

◆ UpdateCSQCProjectile()

◆ UpdateCSQCProjectileAfterTeleport()

void UpdateCSQCProjectileAfterTeleport ( entity e)

Definition at line 114 of file csqcprojectile.qc.

115{
117 {
118 // send new origin data
119 e.SendFlags |= 0x01;
120 // send full data as the projectile may need resetting
121 // this is a workaround for client-side projectiles erroneously calling their SUB_Stop touch function occasionally
122 // when passing through a warpzone
123 e.SendFlags |= 2;
124 // mark as teleported
125 e.SendFlags |= 0x08;
126 }
127}

References CSQCProjectile_SendEntity(), entity(), and getSendEntity.

Referenced by TeleportPlayer(), and WarpZone_PostTeleportPlayer_Callback().

Variable Documentation

◆ csqcprojectile_oldorigin

vector csqcprojectile_oldorigin

Definition at line 70 of file csqcprojectile.qc.

◆ csqcprojectile_type

float csqcprojectile_type

Definition at line 11 of file csqcprojectile.qc.

Referenced by CSQCProjectile_SendEntity().