Xonotic
waypointsprites.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #include "all.qh"
4 
6 .int wp_extra;
7 
8 const int SPRITERULE_DEFAULT = 0;
9 const int SPRITERULE_TEAMPLAY = 1;
10 const int SPRITERULE_SPECTATOR = 2;
11 
12 #ifdef CSQC
13 entityclass(WaypointSprite);
14 classfield(WaypointSprite) .float helpme;
15 classfield(WaypointSprite) .float rule;
16 classfield(WaypointSprite) .string netname; // primary picture
17 classfield(WaypointSprite) .string netname2; // secondary picture
18 classfield(WaypointSprite) .string netname3; // tertiary picture
19 classfield(WaypointSprite) .int team; // team that gets netname2
20 classfield(WaypointSprite) .float lifetime;
21 classfield(WaypointSprite) .float fadetime;
22 classfield(WaypointSprite) .float maxdistance;
23 classfield(WaypointSprite) .int hideflags;
24 classfield(WaypointSprite) .float spawntime;
25 classfield(WaypointSprite) .float health;
26 classfield(WaypointSprite) .float build_started;
27 classfield(WaypointSprite) .float build_starthealth;
28 classfield(WaypointSprite) .float build_finished;
29 
30 bool autocvar_cl_hidewaypoints;
31 
32 float autocvar_g_waypointsprite_alpha;
33 float autocvar_g_waypointsprite_crosshairfadealpha;
34 float autocvar_g_waypointsprite_crosshairfadedistance;
35 float autocvar_g_waypointsprite_crosshairfadescale;
36 float autocvar_g_waypointsprite_distancealphaexponent;
37 float autocvar_g_waypointsprite_distancefadealpha;
38 float autocvar_g_waypointsprite_distancefadedistancemultiplier;
39 float autocvar_g_waypointsprite_distancefadescale;
40 float autocvar_g_waypointsprite_edgefadealpha;
41 float autocvar_g_waypointsprite_edgefadedistance;
42 float autocvar_g_waypointsprite_edgefadescale;
43 float autocvar_g_waypointsprite_edgeoffset_bottom;
44 float autocvar_g_waypointsprite_edgeoffset_left;
45 float autocvar_g_waypointsprite_edgeoffset_right;
46 float autocvar_g_waypointsprite_edgeoffset_top;
47 float autocvar_g_waypointsprite_fontsize;
48 int autocvar_g_waypointsprite_itemstime;
49 float autocvar_g_waypointsprite_minalpha;
50 float autocvar_g_waypointsprite_minscale;
51 float autocvar_g_waypointsprite_normdistance;
52 float autocvar_g_waypointsprite_scale;
53 int autocvar_g_waypointsprite_spam;
54 float autocvar_g_waypointsprite_timealphaexponent;
55 bool autocvar_g_waypointsprite_turrets = true;
56 float autocvar_g_waypointsprite_turrets_maxdist = 5000;
57 bool autocvar_g_waypointsprite_turrets_text = false;
58 bool autocvar_g_waypointsprite_turrets_onlyhurt = false;
59 bool autocvar_g_waypointsprite_uppercase;
60 bool autocvar_g_waypointsprite_text;
61 float autocvar_g_waypointsprite_iconsize = 32;
62 bool autocvar_g_waypointsprite_iconcolor;
63 
64 float waypointsprite_fadedistance;
65 float waypointsprite_normdistance;
66 float waypointsprite_minscale;
67 float waypointsprite_minalpha;
68 float waypointsprite_distancealphaexponent;
69 float waypointsprite_timealphaexponent;
70 float waypointsprite_scale;
71 float waypointsprite_fontsize;
72 float waypointsprite_edgefadealpha;
73 float waypointsprite_edgefadescale;
74 float waypointsprite_edgefadedistance;
75 float waypointsprite_edgeoffset_bottom;
76 float waypointsprite_edgeoffset_left;
77 float waypointsprite_edgeoffset_right;
78 float waypointsprite_edgeoffset_top;
79 float waypointsprite_crosshairfadealpha;
80 float waypointsprite_crosshairfadescale;
81 float waypointsprite_crosshairfadedistance;
82 float waypointsprite_distancefadealpha;
83 float waypointsprite_distancefadescale;
84 float waypointsprite_distancefadedistance;
85 float waypointsprite_alpha;
86 
87 const float SPRITE_HEALTHBAR_WIDTH = 104;
88 const float SPRITE_HEALTHBAR_HEIGHT = 7;
89 const float SPRITE_HEALTHBAR_MARGIN = 6;
90 const float SPRITE_HEALTHBAR_BORDER = 2;
91 const float SPRITE_HEALTHBAR_BORDERALPHA = 1;
92 const float SPRITE_HEALTHBAR_HEALTHALPHA = 0.5;
93 const float SPRITE_ARROW_SCALE = 1.0;
94 const float SPRITE_HELPME_BLINK = 2;
95 
96 float waypointsprite_count, waypointsprite_newcount;
97 
98 void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, vector rgb, float a, float f);
99 
100 void drawquad(vector o, vector ri, vector up, string pic, vector rgb, float a, float f);
101 
102 void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, float width, float height, float margin, float border, float align, vector rgb, float a, vector hrgb, float ha, float f);
103 
104 // returns location of sprite text
105 vector drawspritearrow(vector o, float ang, vector rgb, float a, float t);
106 
107 // returns location of sprite healthbar
108 vector drawsprite_TextOrIcon(bool is_text, vector o, float ang, float minwidth, vector rgb, float a, vector sz, string str);
109 
110 float spritelookupblinkvalue(entity this, string s);
111 vector spritelookupcolor(entity this, string s, vector def);
112 string spritelookuptext(entity this, string s);
113 
114 vector fixrgbexcess_move(vector rgb, vector src, vector dst);
115 vector fixrgbexcess(vector rgb);
116 
117 // they are drawn using a .draw function
118 
119 void Ent_RemoveWaypointSprite(entity this);
120 
121 void Ent_WaypointSprite(entity this, bool isnew);
122 
123 void WaypointSprite_Load_Frames(string ext);
124 
125 void WaypointSprite_Load();
126 .float alpha;
127 void Draw_WaypointSprite(entity this);
128 #endif
129 
130 #ifdef SVQC
131 .entity sprite;
132 
133 float autocvar_sv_waypointsprite_deadlifetime;
134 float autocvar_sv_waypointsprite_deployed_lifetime;
135 float autocvar_sv_waypointsprite_limitedrange;
136 
137 ..entity owned_by_field;
138 .float rule;
139 .string model1;
140 .string model2;
141 .string model3;
142 
143 .bool(entity, entity, entity) waypointsprite_visible_for_player;
144 
145 void WaypointSprite_UpdateSprites(entity e, entity m1, entity m2, entity m3);
146 
147 void WaypointSprite_UpdateHealth(entity e, float f);
148 
149 void WaypointSprite_UpdateMaxHealth(entity e, float f);
150 
151 void WaypointSprite_UpdateBuildFinished(entity e, float f);
152 
153 void WaypointSprite_UpdateOrigin(entity e, vector o);
154 
155 void WaypointSprite_UpdateRule(entity e, float t, float r);
156 
157 void WaypointSprite_UpdateTeamRadar(entity e, entity icon, vector col);
158 
159 .float waypointsprite_pingtime;
160 .float waypointsprite_helpmetime;
161 void WaypointSprite_Ping(entity e);
162 
163 float waypointsprite_limitedrange, waypointsprite_deployed_lifetime, waypointsprite_deadlifetime;
164 
165 void WaypointSprite_HelpMePing(entity e);
166 
167 void WaypointSprite_FadeOutIn(entity e, float t);
168 
169 void WaypointSprite_Init();
170 
171 void WaypointSprite_Kill(entity wp);
172 
173 void WaypointSprite_Disown(entity wp, float fadetime);
174 
175 void WaypointSprite_Think(entity this);
176 
177 bool WaypointSprite_visible_for_player(entity this, entity player, entity view);
178 
179 entity WaypointSprite_getviewentity(entity e);
180 
181 float WaypointSprite_isteammate(entity e, entity e2);
182 
183 bool WaypointSprite_Customize(entity this, entity client);
184 
185 bool WaypointSprite_SendEntity(entity this, entity to, float sendflags);
186 
187 void WaypointSprite_Reset(entity this);
188 
189 entity WaypointSprite_Spawn(
190  entity spr, // sprite
191  float lifetime, float maxdistance, // lifetime, max distance
192  entity ref, vector ofs, // position
193  entity showto, float t, // show to whom? Use a flag to indicate a team
194  entity own, .entity ownfield, // remove when own gets killed
195  float hideable, // true when it should be controlled by cl_hidewaypoints
196  entity icon // initial icon
197 );
198 
199 entity WaypointSprite_SpawnFixed(
200  entity spr,
201  vector ofs,
202  entity own,
203  .entity ownfield,
204  entity icon // initial icon
205 );
206 
207 .entity waypointsprite_deployed_fixed;
208 entity WaypointSprite_DeployFixed(
209  entity spr,
210  bool limited_range,
211  entity player,
212  vector ofs,
213  entity icon // initial icon
214 );
215 
216 .entity waypointsprite_deployed_personal;
217 entity WaypointSprite_DeployPersonal(
218  entity spr,
219  entity player,
220  vector ofs,
221  entity icon // initial icon
222 );
223 
224 .entity waypointsprite_attached;
225 .entity waypointsprite_attachedforcarrier;
226 entity WaypointSprite_Attach(
227  entity spr,
228  entity player,
229  bool limited_range,
230  entity icon // initial icon
231 );
232 
233 entity WaypointSprite_AttachCarrier(
234  entity spr,
235  entity carrier,
236  entity icon // initial icon
237 );
238 
239 void WaypointSprite_DetachCarrier(entity carrier);
240 
241 void WaypointSprite_ClearPersonal(entity this);
242 
243 void WaypointSprite_ClearOwned(entity this);
244 
245 void WaypointSprite_PlayerDead(entity this);
246 
247 void WaypointSprite_PlayerGone(entity this);
248 #endif
const int SPRITERULE_SPECTATOR
float alpha
Definition: items.qc:14
entity sprite
Definition: sv_assault.qc:11
const int SPRITERULE_DEFAULT
int team
Definition: main.qh:157
entity() spawn
string netname
Definition: powerups.qc:20
#define classfield(name)
Definition: oo.qh:52
entity to
Definition: self.qh:96
const int SPRITERULE_TEAMPLAY
float lifetime
Definition: powerups.qc:23
int wp_extra
Additional networked waypoint state, used for items, weapons, buffs.
float height
Definition: jumppads.qh:12
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float health
Definition: progsdefs.qc:137
entity int sendflags
Definition: self.qh:96
#define entityclass(...)
Definition: oo.qh:47
float spawntime
Definition: items.qh:15