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

Go to the source code of this file.

Functions

 NET_HANDLE (Nade_Orb, bool isNew)
void orb_draw (entity this)
void orb_draw2d (entity this)
bool orb_send (entity this, entity to, int sf)
void orb_setup (entity e)

Variables

float ltime
float orb_drawtime

Function Documentation

◆ NET_HANDLE()

NET_HANDLE ( Nade_Orb ,
bool isNew )

Definition at line 66 of file net.qc.

67{
68 Net_Accept(Nade_Orb);
69 int sf = ReadByte();
70 if (sf & 1) {
71 this.origin = ReadVector();
72 setorigin(this, this.origin);
73 this.colormod = ReadVector();
74 this.orb_lifetime = ReadByte();
75 this.orb_radius = ReadShort();
76 this.ltime = time + ReadByte()/10.0;
77 // this.ltime = time + this.orb_lifetime;
78 orb_setup(this);
79 }
80 return true;
81}
vector colormod
Definition powerups.qc:21
float time
vector origin
#define ReadVector()
Definition net.qh:367
#define Net_Accept(classname)
Definition net.qh:201
int ReadByte()
float orb_radius
Definition nades.qh:71
float orb_lifetime
Definition nades.qh:70
void orb_setup(entity e)
Definition net.qc:37
float ltime
Definition net.qc:10

References colormod, ltime, Net_Accept, orb_lifetime, orb_radius, orb_setup(), origin, ReadByte(), ReadVector, and time.

◆ orb_draw()

void orb_draw ( entity this)

Definition at line 11 of file net.qc.

12{
13 float dt = time - this.move_time;
14 this.move_time = time;
15 if(dt <= 0)
16 return;
17
18 this.alpha = (this.ltime - time) / this.orb_lifetime;
19 this.scale = min((1 - this.alpha)*this.orb_lifetime*4,1)*this.orb_radius;
20 this.angles = this.angles + dt * this.avelocity;
21}
float alpha
Definition items.qc:13
vector avelocity
ent angles
Definition ent_cs.qc:121
float min(float f,...)
float move_time
Definition movetypes.qh:77
float scale
Definition projectile.qc:14

References alpha, angles, avelocity, entity(), ltime, min(), move_time, orb_lifetime, orb_radius, scale, and time.

Referenced by orb_setup().

◆ orb_draw2d()

void orb_draw2d ( entity this)

Definition at line 24 of file net.qc.

25{
26 if(time <= orb_drawtime)
27 return;
28
29 if(boxesoverlap(view_origin - '1 1 1', view_origin + '1 1 1', this.absmin, this.absmax))
30 {
31 orb_drawtime = time; // prevent rendering more than one of these per frame!
32 float orb_alpha = 0.65 * (this.ltime - time) / this.orb_lifetime;
34 }
35}
#define drawfill(position, size, rgb, alpha, flag)
Definition draw.qh:36
vector view_origin
Definition main.qh:109
const float DRAWFLAG_ADDITIVE
vector absmax
vector absmin
noref float vid_conwidth
Definition draw.qh:8
noref float vid_conheight
Definition draw.qh:9
float orb_drawtime
Definition net.qc:23
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
Definition vector.qh:73
#define vec2(...)
Definition vector.qh:90
float autocvar_hud_colorflash_alpha
Definition view.qh:39

References absmax, absmin, autocvar_hud_colorflash_alpha, boxesoverlap(), colormod, drawfill, DRAWFLAG_ADDITIVE, entity(), ltime, orb_drawtime, orb_lifetime, time, vec2, vid_conheight, vid_conwidth, and view_origin.

Referenced by orb_setup().

◆ orb_send()

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

Definition at line 85 of file net.qc.

86{
87 int channel = MSG_ENTITY;
88 WriteHeader(channel, Nade_Orb);
89 WriteByte(channel, sf);
90 if (sf & 1) {
91 WriteVector(channel, this.origin);
92
93 WriteVector(channel, this.colormod);
94
95 WriteByte(channel, this.orb_lifetime);
96 //WriteByte(MSG_ENTITY, this.ltime - time + 1);
97 WriteShort(channel, this.orb_radius);
98 // round time delta to a 1/10th of a second
99 WriteByte(channel, (this.ltime - time)*10.0+0.5);
100 }
101 return true;
102}
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
void WriteShort(float data, float dest, float desto)
void WriteByte(float data, float dest, float desto)

References colormod, entity(), ltime, MSG_ENTITY, orb_lifetime, orb_radius, origin, time, WriteByte(), WriteHeader, and WriteShort().

Referenced by nades_spawn_orb().

◆ orb_setup()

void orb_setup ( entity e)

Definition at line 37 of file net.qc.

38{
39 setmodel(e, MDL_NADE_ORB);
40 e.skin = 1;
41
42 setorigin(e, e.origin);
43
44 float model_radius = e.maxs.x;
45 vector size = '.5 .5 .5' * e.orb_radius;
46 setsize(e,-size,size);
47 e.orb_radius = e.orb_radius/model_radius*0.6;
48
49 e.draw = orb_draw;
50 e.draw2d = orb_draw2d;
53 SetResourceExplicit(e, RES_HEALTH, 255);
55 e.solid = SOLID_NOT;
56 e.drawmask = MASK_NORMAL;
57 e.scale = 0.01;
58 e.avelocity = '7 0 11';
59 e.renderflags |= RF_ADDITIVE;
60}
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
IntrusiveList g_drawables
Definition main.qh:91
IntrusiveList g_drawables_2d
Definition main.qh:92
#define setmodel(this, m)
Definition model.qh:26
const float RF_ADDITIVE
const float MASK_NORMAL
const float SOLID_NOT
vector size
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_NONE
Definition movetypes.qh:129
void orb_draw(entity this)
Definition net.qc:11
void orb_draw2d(entity this)
Definition net.qc:24
vector
Definition self.qh:92

References entity(), g_drawables, g_drawables_2d, IL_PUSH(), MASK_NORMAL, MOVETYPE_NONE, orb_draw(), orb_draw2d(), RF_ADDITIVE, set_movetype(), setmodel, SetResourceExplicit(), size, SOLID_NOT, and vector.

Referenced by NET_HANDLE().

Variable Documentation

◆ ltime

◆ orb_drawtime

float orb_drawtime

Definition at line 23 of file net.qc.

Referenced by orb_draw2d().