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

Go to the source code of this file.

Functions

void raptor_blowup (entity this, entity toucher)
void raptor_diethink (entity this)
void raptor_exit (entity this, int eject)
bool raptor_frame (entity this, float dt)
bool raptor_impulse (entity this, int _imp)
void raptor_land (entity this)
void raptor_rotor_anglefix (entity this)
bool raptor_takeoff (entity this, float dt)
 spawnfunc (vehicle_raptor)

Variables

bool autocvar_g_vehicle_raptor = true
float autocvar_g_vehicle_raptor_bouncefactor = 0.2
vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000'
float autocvar_g_vehicle_raptor_bouncestop = 0
float autocvar_g_vehicle_raptor_cannon_locked_time = 1
float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45
float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2
bool autocvar_g_vehicle_raptor_cannon_locktarget = true
float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32
float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12
float autocvar_g_vehicle_raptor_cannon_predicttarget = 1
float autocvar_g_vehicle_raptor_cannon_turnlimit = 20
float autocvar_g_vehicle_raptor_cannon_turnspeed = 120
float autocvar_g_vehicle_raptor_energy = 100
float autocvar_g_vehicle_raptor_energy_regen = 25
float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25
float autocvar_g_vehicle_raptor_friction = 2
float autocvar_g_vehicle_raptor_health = 250
float autocvar_g_vehicle_raptor_health_regen = 0
float autocvar_g_vehicle_raptor_health_regen_pause = 0
int autocvar_g_vehicle_raptor_movestyle = 1
float autocvar_g_vehicle_raptor_pitchlimit = 45
float autocvar_g_vehicle_raptor_pitchspeed = 50
float autocvar_g_vehicle_raptor_respawntime = 40
float autocvar_g_vehicle_raptor_shield = 200
float autocvar_g_vehicle_raptor_shield_regen = 25
float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5
float autocvar_g_vehicle_raptor_speed_down = 2000
float autocvar_g_vehicle_raptor_speed_forward = 1700
float autocvar_g_vehicle_raptor_speed_strafe = 2200
float autocvar_g_vehicle_raptor_speed_up = 2300
bool autocvar_g_vehicle_raptor_swim = false
float autocvar_g_vehicle_raptor_takeofftime = 1.5
float autocvar_g_vehicle_raptor_turnspeed = 200
entity bomb1
entity bomb2

Function Documentation

◆ raptor_blowup()

void raptor_blowup ( entity this,
entity toucher )

Definition at line 489 of file raptor.qc.

490{
491 this.deadflag = DEAD_DEAD;
492 this.vehicle_exit(this, VHEF_NORMAL);
493 RadiusDamage(this, this.enemy,
494 250,
495 15,
496 250,
497 NULL,
498 NULL,
499 250,
500 DEATH_VH_RAPT_DEATH.m_id,
501 DMG_NOWEP,
502 NULL
503 );
504
505 this.alpha = -1;
507 this.effects = EF_NODRAW;
508 this.colormod = '0 0 0';
509 this.avelocity = '0 0 0';
510 this.velocity = '0 0 0';
511
512 setorigin(this, this.pos1);
513 settouch(this, func_null);
514 this.nextthink = 0;
515}
vector colormod
Definition powerups.qc:21
float alpha
Definition items.qc:13
vector avelocity
vector velocity
float effects
float nextthink
const float EF_NODRAW
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition damage.qc:943
#define DMG_NOWEP
Definition damage.qh:104
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_NONE
Definition movetypes.qh:129
var void func_null()
#define NULL
Definition post.qh:14
float deadflag
Definition progsdefs.qc:149
float DEAD_DEAD
Definition progsdefs.qc:276
#define settouch(e, f)
Definition self.qh:73
vector pos1
Definition subs.qh:50
entity enemy
Definition sv_ctf.qh:153
const int VHEF_NORMAL
User pressed exit key.

References alpha, avelocity, colormod, DEAD_DEAD, deadflag, DMG_NOWEP, EF_NODRAW, effects, enemy, entity(), func_null(), MOVETYPE_NONE, nextthink, NULL, pos1, RadiusDamage(), set_movetype(), settouch, toucher, velocity, and VHEF_NORMAL.

Referenced by raptor_diethink().

◆ raptor_diethink()

void raptor_diethink ( entity this)

Definition at line 517 of file raptor.qc.

518{
519 if (time >= this.wait)
520 {
521 raptor_blowup(this, NULL);
522 return;
523 }
524
525 if (random() < 0.05)
526 {
527 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
528 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
529 }
530 this.nextthink = time;
531
533}
float wait
Definition items.qc:17
float time
vector origin
#define CSQCMODEL_AUTOUPDATE(e)
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120
float random(void)
vector randomvec(void)
void raptor_blowup(entity this, entity toucher)
Definition raptor.qc:489
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52

References ATTEN_NORM, CH_SHOTS, CSQCMODEL_AUTOUPDATE, entity(), nextthink, NULL, origin, random(), randomvec(), raptor_blowup(), Send_Effect(), sound, time, VOL_BASE, and wait.

◆ raptor_exit()

void raptor_exit ( entity this,
int eject )

Definition at line 86 of file raptor.qc.

87{
88 entity player = this.owner;
89
90 this.tur_head.exteriormodeltoclient = NULL;
91
92 if (!IS_DEAD(this))
93 {
94 setthink(this, raptor_land);
95 this.nextthink = time;
96 }
97
98 if (!player)
99 return;
100
101 makevectors(this.angles);
102 vector spot;
103 if (eject)
104 {
105 spot = this.origin + v_forward * 100 + '0 0 64';
106 spot = vehicles_findgoodexit(this, player, spot);
107 setorigin(player, spot);
108 player.velocity = (v_up + v_forward * 0.25) * 750;
109 player.oldvelocity = player.velocity;
110 }
111 else
112 {
113 if (vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed))
114 {
115 player.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2;
116 player.velocity.z += 200;
117 spot = this.origin + v_forward * 32 + '0 0 64';
118 spot = vehicles_findgoodexit(this, player, spot);
119 }
120 else
121 {
122 player.velocity = this.velocity * 0.5;
123 player.velocity.z += 10;
124 spot = this.origin - v_forward * 200 + '0 0 64';
125 spot = vehicles_findgoodexit(this, player, spot);
126 }
127 player.oldvelocity = player.velocity;
128 setorigin(player, spot);
129 }
130
131 this.owner = NULL;
132 antilag_clear(player, CS(player));
133}
void antilag_clear(entity e, entity store)
Definition antilag.qc:114
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity owner
Definition main.qh:87
#define IS_DEAD(s)
Definition player.qh:244
float autocvar_sv_maxairspeed
Definition player.qh:52
vector v_up
vector v_forward
ent angles
Definition ent_cs.qc:121
vector normalize(vector v)
#define makevectors
Definition post.qh:21
void raptor_land(entity this)
Definition raptor.qc:61
#define setthink(e, f)
vector
Definition self.qh:92
ClientState CS(Client this)
Definition state.qh:47
entity tur_head
Definition sv_turrets.qh:28
vector vehicles_findgoodexit(entity this, entity player, vector prefer_spot)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

References angles, antilag_clear(), autocvar_sv_maxairspeed, CS(), entity(), IS_DEAD, makevectors, nextthink, normalize(), NULL, origin, owner, raptor_land(), setthink, time, tur_head, v_forward, v_up, vdist, vector, vehicles_findgoodexit(), and velocity.

◆ raptor_frame()

bool raptor_frame ( entity this,
float dt )

Definition at line 135 of file raptor.qc.

136{
137 entity vehic = this.vehicle;
138 return = true;
139
140 if (game_stopped)
141 {
142 vehic.solid = SOLID_NOT;
143 vehic.takedamage = DAMAGE_NO;
145 return;
146 }
147
148 vehicles_frame(vehic, this);
149
150 /*
151 float ftmp = vlen(vehic.velocity);
152 if (ftmp > autocvar_g_vehicle_raptor_speed_forward)
153 ftmp = 1;
154 else
155 ftmp /= autocvar_g_vehicle_raptor_speed_forward;
156 */
157
158 if (vehic.sound_nexttime < time)
159 {
160 vehic.sound_nexttime = time + 7.955812;
161 //sound(vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM);
162 sound(vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
163 vehic.wait = 0;
164 }
165 /*
166 else if (fabs(ftmp - vehic.wait) > 0.2)
167 {
168 sound(vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM);
169 sound(vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
170 vehic.wait = ftmp;
171 }
172 */
173
174 if (IS_DEAD(vehic))
175 {
177 return;
178 }
179 crosshair_trace(this);
180
181 //if (time - vehic.lastteleporttime < 1)
182 if ((vehic.angles.z > 50 || vehic.angles.z < -50)
183 && PHYS_INPUT_BUTTON_JUMP(this))
184 {
185 PHYS_INPUT_BUTTON_CROUCH(this) = true;
186 PHYS_INPUT_BUTTON_JUMP(this) = false;
187 }
188
189 vector vang = vehic.angles;
190 vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
191 vang.x = -vang.x;
192 df.x = -df.x;
193 if (df.x > 180) df.x -= 360;
194 if (df.x < -180) df.x += 360;
195 if (df.y > 180) df.y -= 360;
196 if (df.y < -180) df.y += 360;
197
198 float ftmp = shortangle_f(this.v_angle.y - vang.y, vang.y);
199 if (ftmp > 180) ftmp -= 360;
200 if (ftmp < -180) ftmp += 360;
201 vehic.avelocity.y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity.y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
202
203 // Pitch
204 ftmp = 0;
205 if (CS(this).movement.x > 0 && vang.x < autocvar_g_vehicle_raptor_pitchlimit)
206 ftmp = 5;
207 else if (CS(this).movement.x < 0 && vang.x > -autocvar_g_vehicle_raptor_pitchlimit)
208 ftmp = -20;
209
212 vehic.avelocity.x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity.x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
213
214 vehic.angles.x = anglemods(vehic.angles.x);
215 vehic.angles.y = anglemods(vehic.angles.y);
216 vehic.angles.z = anglemods(vehic.angles.z);
217
219 makevectors('0 1 0' * vehic.angles.y);
220 else
221 makevectors(this.v_angle);
222
223 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
224
225 if (CS(this).movement.x != 0)
226 {
227 if (CS(this).movement.x > 0)
229 else if (CS(this).movement.x < 0)
231 }
232
233 if (CS(this).movement.y != 0)
234 {
235 if (CS(this).movement.y < 0)
237 else if (CS(this).movement.y > 0)
239
240 vehic.angles.z = bound(-30, vehic.angles.z + CS(this).movement.y / autocvar_g_vehicle_raptor_speed_strafe, 30);
241 }
242 else
243 {
244 vehic.angles.z *= 0.95;
245 if (vehic.angles.z >= -1 && vehic.angles.z <= -1)
246 vehic.angles.z = 0;
247 }
248
249 if (PHYS_INPUT_BUTTON_CROUCH(this))
251 else if (PHYS_INPUT_BUTTON_JUMP(this))
253
254 vehic.velocity += df * dt;
255 this.velocity = CS(this).movement = vehic.velocity;
256 setorigin(this, vehic.origin + '0 0 32');
257 this.oldorigin = this.origin; // negate fall damage
258
259 STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
260
261 vector vf, ad;
262 // Target lock & predict
264 {
265 if (vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
266 vehic.gun1.enemy = NULL;
267
268 if (trace_ent
269 && trace_ent.move_movetype
270 && trace_ent.takedamage
271 && !IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
272 {
273 if (teamplay)
274 {
275 if (trace_ent.team != this.team)
276 {
277 vehic.gun1.enemy = trace_ent;
278 vehic.gun1.lock_time = time + 5;
279 }
280 }
281 else
282 {
283 vehic.gun1.enemy = trace_ent;
284 vehic.gun1.lock_time = time + 0.5;
285 }
286 }
287
288 if (vehic.gun1.enemy)
289 {
290 vf = real_origin(vehic.gun1.enemy);
291 UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
292 vector _vel = vehic.gun1.enemy.velocity;
293 if (vehic.gun1.enemy.move_movetype == MOVETYPE_WALK)
294 _vel.z *= 0.1;
295
297 {
298 ad = vf;
299 float distance = vlen(ad - this.origin);
300 float impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
301 ad = vf + _vel * impact_time;
302 trace_endpos = ad;
303 }
304 else
305 trace_endpos = vf;
306 }
307 }
309 {
310
314
315 if (vehic.lock_target != NULL
317 && vehic.lock_strength == 1)
318 {
319 float distance, impact_time;
320
321 vf = real_origin(vehic.lock_target);
322 ad = vf;
323 for (int i = 0; i < 4; ++i)
324 {
325 distance = vlen(ad - vehic.origin);
326 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
327 ad = vf + vehic.lock_target.velocity * impact_time;
328 }
329 trace_endpos = ad;
330 }
331
332 if (vehic.lock_target)
333 {
334 if (vehic.lock_strength == 1)
335 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
336 else if (vehic.lock_strength > 0.5)
337 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
338 else if (vehic.lock_strength < 0.5)
339 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
340 }
341 }
342
343
344 vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
347
348 vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
351
352 /*
353 ad *= 0.5;
354 v_forward = vf * 0.5;
355 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
356 UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
357 */
358
359 Weapon wep1 = WEP_RAPTOR;
360 .entity weaponentity = weaponentities[0];
361 if (!weaponLocked(this) && !weaponUseForbidden(this)
363 && wep1.wr_checkammo1(wep1, vehic, weaponentity))
364 wep1.wr_think(wep1, vehic, weaponentity, 1);
365
366 if (vehic.vehicle_flags & VHF_SHIELDREGEN)
368
369 if (vehic.vehicle_flags & VHF_HEALTHREGEN)
371
372 if (vehic.vehicle_flags & VHF_ENERGYREGEN)
374
375 Weapon wep2a = WEP_RAPTOR_BOMB;
376 if (!weaponLocked(this) && !weaponUseForbidden(this)
377 && STAT(VEHICLESTAT_W2MODE, vehic) == RSM_BOMB)
378 {
381 {
382 .entity weaponentity = weaponentities[1];
383 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
385 vehic.lip = time;
386 }
387 }
388 else
389 {
390 Weapon wep2b = WEP_RAPTOR_FLARE;
393 {
394 .entity weaponentity = weaponentities[1];
395 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
397 vehic.lip = time;
398 }
399 }
400
401 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
402 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
403 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
404
405 if (vehic.bomb1.cnt < time)
406 {
407 bool incoming = false;
408 IL_EACH(g_projectiles, it.enemy == vehic,
409 {
410 if ((it.missile_flags & MIF_GUIDED_TRACKING)
411 && vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
412 {
413 incoming = true;
414 break;
415 }
416 });
417
418 if (incoming)
419 {
420 msg_entity = this;
421 soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE, 0);
422 }
423
424 vehic.bomb1.cnt = time + 1;
425 }
426
427 VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH);
428 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
429 if (vehic.vehicle_flags & VHF_HASSHIELD)
430 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
431
433}
ERASEABLE float anglemods(float v)
Definition angle.qc:13
ERASEABLE float shortangle_f(float ang1, float ang2)
Definition angle.qc:29
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:42
virtual void wr_think()
(SERVER) logic to run every frame
Definition weapon.qh:98
virtual void wr_checkammo1()
(SERVER) checks ammo for weapon primary
Definition weapon.qh:100
#define PHYS_INPUT_BUTTON_CROUCH(s)
Definition player.qh:156
vector movement
Definition player.qh:228
#define PHYS_INPUT_BUTTON_JUMP(s)
Definition player.qh:153
vector v_angle
Definition player.qh:236
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:152
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition player.qh:154
float game_stopped
Definition stats.qh:81
vector real_origin(entity ent)
Definition util.qc:147
entity trace_ent
const float SOLID_NOT
vector v_right
vector trace_endpos
vector oldorigin
#define IL_EACH(this, cond, body)
#define STAT(...)
Definition stats.qh:82
float MSG_ONE
Definition menudefs.qc:56
float bound(float min, float value, float max)
float vlen(vector v)
vector vectoangles(vector v)
const int MOVETYPE_WALK
Definition movetypes.qh:132
entity msg_entity
Definition progsdefs.qc:63
float autocvar_g_vehicle_raptor_shield
Definition raptor.qc:50
float autocvar_g_vehicle_raptor_energy
Definition raptor.qc:42
float autocvar_g_vehicle_raptor_cannon_turnspeed
Definition raptor.qc:31
float autocvar_g_vehicle_raptor_cannon_pitchlimit_down
Definition raptor.qc:34
float autocvar_g_vehicle_raptor_health
Definition raptor.qc:46
float autocvar_g_vehicle_raptor_turnspeed
Definition raptor.qc:19
float autocvar_g_vehicle_raptor_cannon_locking_releasetime
Definition raptor.qc:38
float autocvar_g_vehicle_raptor_speed_up
Definition raptor.qc:25
float autocvar_g_vehicle_raptor_cannon_predicttarget
Definition raptor.qc:40
float autocvar_g_vehicle_raptor_energy_regen_pause
Definition raptor.qc:44
float autocvar_g_vehicle_raptor_pitchlimit
Definition raptor.qc:21
float autocvar_g_vehicle_raptor_health_regen_pause
Definition raptor.qc:48
int autocvar_g_vehicle_raptor_movestyle
Definition raptor.qc:18
float autocvar_g_vehicle_raptor_cannon_locking_time
Definition raptor.qc:37
float autocvar_g_vehicle_raptor_cannon_turnlimit
Definition raptor.qc:32
float autocvar_g_vehicle_raptor_speed_down
Definition raptor.qc:26
float autocvar_g_vehicle_raptor_shield_regen_pause
Definition raptor.qc:52
float autocvar_g_vehicle_raptor_energy_regen
Definition raptor.qc:43
float autocvar_g_vehicle_raptor_shield_regen
Definition raptor.qc:51
float autocvar_g_vehicle_raptor_cannon_locked_time
Definition raptor.qc:39
float autocvar_g_vehicle_raptor_speed_forward
Definition raptor.qc:23
float autocvar_g_vehicle_raptor_cannon_pitchlimit_up
Definition raptor.qc:33
float autocvar_g_vehicle_raptor_friction
Definition raptor.qc:27
float autocvar_g_vehicle_raptor_health_regen
Definition raptor.qc:47
float autocvar_g_vehicle_raptor_speed_strafe
Definition raptor.qc:24
bool autocvar_g_vehicle_raptor_cannon_locktarget
Definition raptor.qc:36
float autocvar_g_vehicle_raptor_pitchspeed
Definition raptor.qc:20
const int RSM_BOMB
Definition raptor.qh:30
float autocvar_g_vehicle_raptor_cannon_speed
float autocvar_g_vehicle_raptor_bombs_refire
float autocvar_g_vehicle_raptor_flare_refire
float health
Legacy fields for the resources. To be removed.
Definition resources.qh:9
IntrusiveList g_projectiles
Definition common.qh:58
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
const int CH_PAIN_SINGLE
Definition sound.qh:19
const float ATTEN_NONE
Definition sound.qh:27
void soundto(int _dest, entity e, int chan, string samp, float vol, float _atten, float _pitch)
Definition all.qc:74
#define SND(id)
Definition all.qh:35
const int DAMAGE_NO
Definition subs.qh:79
void vehicles_regen(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id)
void vehicles_regen_resource(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale, Resource resource)
vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname, float _pichlimit_min, float _pichlimit_max, float _rotlimit_min, float _rotlimit_max, float _aimspeed, float dt)
void vehicles_frame(entity this, entity actor)
void vehicles_locktarget(entity this, float incr, float decr, float _lock_time)
const float vehicle_shield
If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehicle,...
const float vehicle_reload2
If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehicle,...
const float vehicle_health
If ent is player this is 0..100 indicating precentage of health left on vehicle. Vehicle's value is t...
const float vehicle_energy
If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehicle,...
#define VEHICLE_UPDATE_PLAYER(ply, vehi, fld, vhname)
#define VEHICLE_UPDATE_PLAYER_RESOURCE(ply, vehi, fld, vhname, res)
entity vehicle
const float vehicle_ammo2
If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehicle,...
bool teamplay
Definition teams.qh:59
void crosshair_trace(entity pl)
Definition tracing.qc:542
const int VHF_HASSHIELD
Vehicle has shileding.
Definition vehicle.qh:95
const int VHF_HEALTHREGEN
Vehicles health regenerates.
Definition vehicle.qh:97
const int VHF_ENERGYREGEN
Vehicles energy regenerates.
Definition vehicle.qh:98
const int VHF_SHIELDREGEN
Vehicles shield regenerates.
Definition vehicle.qh:96
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17
bool weaponUseForbidden(entity player)
bool weaponLocked(entity player)

References anglemods(), ATTEN_NONE, ATTEN_NORM, autocvar_g_vehicle_raptor_bombs_refire, autocvar_g_vehicle_raptor_cannon_locked_time, autocvar_g_vehicle_raptor_cannon_locking_releasetime, autocvar_g_vehicle_raptor_cannon_locking_time, autocvar_g_vehicle_raptor_cannon_locktarget, autocvar_g_vehicle_raptor_cannon_pitchlimit_down, autocvar_g_vehicle_raptor_cannon_pitchlimit_up, autocvar_g_vehicle_raptor_cannon_predicttarget, autocvar_g_vehicle_raptor_cannon_speed, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_flare_refire, autocvar_g_vehicle_raptor_friction, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_movestyle, autocvar_g_vehicle_raptor_pitchlimit, autocvar_g_vehicle_raptor_pitchspeed, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_speed_down, autocvar_g_vehicle_raptor_speed_forward, autocvar_g_vehicle_raptor_speed_strafe, autocvar_g_vehicle_raptor_speed_up, autocvar_g_vehicle_raptor_turnspeed, bound(), CH_PAIN_SINGLE, CH_TRIGGER_SINGLE, crosshair_trace(), CS(), DAMAGE_NO, entity(), g_projectiles, game_stopped, IL_EACH, IS_DEAD, makevectors, movement, MOVETYPE_NONE, MOVETYPE_WALK, msg_entity, MSG_ONE, normalize(), NULL, oldorigin, origin, PHYS_INPUT_BUTTON_ATCK, PHYS_INPUT_BUTTON_ATCK2, PHYS_INPUT_BUTTON_CROUCH, PHYS_INPUT_BUTTON_JUMP, real_origin(), RSM_BOMB, set_movetype(), shortangle_f(), SND, SOLID_NOT, sound, soundto(), STAT, teamplay, time, trace_endpos, trace_ent, UpdateAuxiliaryXhair(), v_angle, v_forward, v_right, v_up, vectoangles(), vector, vehicle, vehicle_aimturret(), vehicle_ammo2, vehicle_energy, vehicle_health, vehicle_reload2, vehicle_shield, vehicles_frame(), vehicles_locktarget(), vehicles_regen(), vehicles_regen_resource(), velocity, VHF_ENERGYREGEN, VHF_HEALTHREGEN, VHF_SHIELDREGEN, vlen(), VOL_BASE, weaponentities, weaponLocked(), weaponUseForbidden(), Weapon::wr_checkammo1(), and Weapon::wr_think().

Referenced by raptor_takeoff().

◆ raptor_impulse()

bool raptor_impulse ( entity this,
int _imp )

Definition at line 544 of file raptor.qc.

545{
546 switch (_imp)
547 {
548 case IMP_weapon_group_1.impulse:
549 STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_BOMB;
550 CSQCVehicleSetup(this, 0);
551 return true;
552 case IMP_weapon_group_2.impulse:
553 STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_FLARE;
554 CSQCVehicleSetup(this, 0);
555 return true;
556
557 case IMP_weapon_next_byid.impulse:
558 case IMP_weapon_next_bypriority.impulse:
559 case IMP_weapon_next_bygroup.impulse:
560 ++STAT(VEHICLESTAT_W2MODE, this.vehicle);
561 if (STAT(VEHICLESTAT_W2MODE, this.vehicle) > RSM_LAST)
562 STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_FIRST;
563
564 CSQCVehicleSetup(this, 0);
565 return true;
566 case IMP_weapon_last.impulse:
567 case IMP_weapon_prev_byid.impulse:
568 case IMP_weapon_prev_bypriority.impulse:
569 case IMP_weapon_prev_bygroup.impulse:
570 --STAT(VEHICLESTAT_W2MODE, this.vehicle);
571 if (STAT(VEHICLESTAT_W2MODE, this.vehicle) < RSM_FIRST)
572 STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_LAST;
573
574 CSQCVehicleSetup(this, 0);
575 return true;
576
577 /*
578 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
579 break;
580 case IMP_weapon_reload.impulse: // Manual minigun reload?
581 break;
582 */
583 }
584 return false;
585}
const int RSM_LAST
Definition raptor.qh:32
const int RSM_FIRST
Definition raptor.qh:29
const int RSM_FLARE
Definition raptor.qh:31
void CSQCVehicleSetup(entity own, int vehicle_id)

References CSQCVehicleSetup(), entity(), RSM_BOMB, RSM_FIRST, RSM_FLARE, RSM_LAST, STAT, and vehicle.

◆ raptor_land()

void raptor_land ( entity this)

Definition at line 61 of file raptor.qc.

62{
63 float hgt = vehicle_altitude(this, 512);
64 this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME);
65 this.angles.x *= 0.95;
66 this.angles.z *= 0.95;
67
68 if (hgt < 128 && hgt > 0)
69 this.frame = (hgt / 128) * 25;
70
71 this.bomb1.gun1.avelocity.y = 90 + ((this.frame / 25) * 2000);
72 this.bomb1.gun2.avelocity.y = -this.bomb1.gun1.avelocity.y;
73
74 if (hgt < 16)
75 {
78 this.frame = 0;
79 }
80
81 this.nextthink = time;
82
84}
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
Definition anim.qh:6
#define PHYS_INPUT_FRAMETIME
Definition player.qh:254
const int MOVETYPE_TOSS
Definition movetypes.qh:135
entity bomb1
Definition raptor.qc:58
void vehicles_think(entity this)
float vehicle_altitude(entity this, float amax)
Definition vehicles.qc:4

References angles, bomb1, CSQCMODEL_AUTOUPDATE, entity(), frame, MOVETYPE_TOSS, nextthink, PHYS_INPUT_FRAMETIME, set_movetype(), setthink, time, vehicle_altitude(), vehicles_think(), and velocity.

Referenced by raptor_exit().

◆ raptor_rotor_anglefix()

void raptor_rotor_anglefix ( entity this)

Definition at line 537 of file raptor.qc.

538{
539 this.gun1.angles.y = anglemods(this.gun1.angles.y);
540 this.gun2.angles.y = anglemods(this.gun2.angles.y);
541 this.nextthink = time + 15;
542}
entity gun1
entity gun2

References anglemods(), entity(), gun1, gun2, nextthink, and time.

◆ raptor_takeoff()

bool raptor_takeoff ( entity this,
float dt )

Definition at line 435 of file raptor.qc.

436{
437 entity vehic = this.vehicle;
438 return = true;
439
440 vehic.nextthink = time;
442 vehic.nextthink = 0; // will this work?
443
444 if (vehic.sound_nexttime < time)
445 {
446 vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
447 sound(vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
448 }
449
450 // Takeoff sequense
451 if (vehic.frame < 25)
452 {
453 vehic.frame += 25 * dt / autocvar_g_vehicle_raptor_takeofftime;
454 vehic.velocity.z = min(vehic.velocity.z * 1.5, 256);
455 vehic.bomb1.gun1.avelocity.y = 90 + ((vehic.frame / 25) * 25000);
456 vehic.bomb1.gun2.avelocity.y = -vehic.bomb1.gun1.avelocity.y;
458
459 setorigin(this, vehic.origin + '0 0 32');
460 this.oldorigin = this.origin;
461 }
462 else
463 this.PlayerPhysplug = raptor_frame;
464
465 STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
466
467 if (vehic.vehicle_flags & VHF_SHIELDREGEN)
469
470 if (vehic.vehicle_flags & VHF_HEALTHREGEN)
472
473 if (vehic.vehicle_flags & VHF_ENERGYREGEN)
475
476
477 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
478 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
479 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
480
481 VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH);
482 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
483 if (vehic.vehicle_flags & VHF_HASSHIELD)
484 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
485
487}
float min(float f,...)
float autocvar_g_vehicle_raptor_takeofftime
Definition raptor.qc:14
bool raptor_frame(entity this, float dt)
Definition raptor.qc:135
const float VOL_VEHICLEENGINE

References ATTEN_NORM, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_takeofftime, bound(), CH_TRIGGER_SINGLE, CSQCMODEL_AUTOUPDATE, entity(), health, min(), oldorigin, origin, PHYS_INPUT_BUTTON_ATCK, PHYS_INPUT_BUTTON_ATCK2, PHYS_INPUT_BUTTON_CROUCH, raptor_frame(), sound, STAT, time, vehicle, vehicle_ammo2, vehicle_energy, vehicle_health, vehicle_reload2, vehicle_shield, VEHICLE_UPDATE_PLAYER, VEHICLE_UPDATE_PLAYER_RESOURCE, vehicles_regen(), vehicles_regen_resource(), VHF_ENERGYREGEN, VHF_HASSHIELD, VHF_HEALTHREGEN, VHF_SHIELDREGEN, and VOL_VEHICLEENGINE.

◆ spawnfunc()

spawnfunc ( vehicle_raptor )

Definition at line 587 of file raptor.qc.

588{
590 || !vehicle_initialize(this, VEH_RAPTOR, false))
591 {
592 delete(this);
593 return;
594 }
595}
bool autocvar_g_vehicle_raptor
Definition raptor.qc:11
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)

References autocvar_g_vehicle_raptor, and vehicle_initialize().

Variable Documentation

◆ autocvar_g_vehicle_raptor

bool autocvar_g_vehicle_raptor = true

Definition at line 11 of file raptor.qc.

Referenced by spawnfunc().

◆ autocvar_g_vehicle_raptor_bouncefactor

float autocvar_g_vehicle_raptor_bouncefactor = 0.2

Definition at line 54 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_bouncepain

vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000'

Definition at line 56 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_bouncestop

float autocvar_g_vehicle_raptor_bouncestop = 0

Definition at line 55 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_cannon_locked_time

float autocvar_g_vehicle_raptor_cannon_locked_time = 1

Definition at line 39 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_cannon_locking_releasetime

float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45

Definition at line 38 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_cannon_locking_time

float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2

Definition at line 37 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_cannon_locktarget

bool autocvar_g_vehicle_raptor_cannon_locktarget = true

Definition at line 36 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_cannon_pitchlimit_down

float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32

Definition at line 34 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_cannon_pitchlimit_up

float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12

Definition at line 33 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_cannon_predicttarget

float autocvar_g_vehicle_raptor_cannon_predicttarget = 1

Definition at line 40 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_cannon_turnlimit

float autocvar_g_vehicle_raptor_cannon_turnlimit = 20

Definition at line 32 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_cannon_turnspeed

float autocvar_g_vehicle_raptor_cannon_turnspeed = 120

Definition at line 31 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_energy

float autocvar_g_vehicle_raptor_energy = 100

Definition at line 42 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_energy_regen

float autocvar_g_vehicle_raptor_energy_regen = 25

Definition at line 43 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_energy_regen_pause

float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25

Definition at line 44 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_friction

float autocvar_g_vehicle_raptor_friction = 2

Definition at line 27 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_health

float autocvar_g_vehicle_raptor_health = 250

Definition at line 46 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_health_regen

float autocvar_g_vehicle_raptor_health_regen = 0

Definition at line 47 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_health_regen_pause

float autocvar_g_vehicle_raptor_health_regen_pause = 0

Definition at line 48 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_movestyle

int autocvar_g_vehicle_raptor_movestyle = 1

Definition at line 18 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_pitchlimit

float autocvar_g_vehicle_raptor_pitchlimit = 45

Definition at line 21 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_pitchspeed

float autocvar_g_vehicle_raptor_pitchspeed = 50

Definition at line 20 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_respawntime

float autocvar_g_vehicle_raptor_respawntime = 40

Definition at line 13 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_shield

float autocvar_g_vehicle_raptor_shield = 200

Definition at line 50 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_shield_regen

float autocvar_g_vehicle_raptor_shield_regen = 25

Definition at line 51 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_shield_regen_pause

float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5

Definition at line 52 of file raptor.qc.

Referenced by raptor_frame(), and raptor_takeoff().

◆ autocvar_g_vehicle_raptor_speed_down

float autocvar_g_vehicle_raptor_speed_down = 2000

Definition at line 26 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_speed_forward

float autocvar_g_vehicle_raptor_speed_forward = 1700

Definition at line 23 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_speed_strafe

float autocvar_g_vehicle_raptor_speed_strafe = 2200

Definition at line 24 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_speed_up

float autocvar_g_vehicle_raptor_speed_up = 2300

Definition at line 25 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_swim

bool autocvar_g_vehicle_raptor_swim = false

Definition at line 29 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_takeofftime

float autocvar_g_vehicle_raptor_takeofftime = 1.5

Definition at line 14 of file raptor.qc.

Referenced by raptor_takeoff().

◆ autocvar_g_vehicle_raptor_turnspeed

float autocvar_g_vehicle_raptor_turnspeed = 200

Definition at line 19 of file raptor.qc.

Referenced by raptor_frame().

◆ bomb1

entity bomb1

Definition at line 58 of file raptor.qc.

Referenced by raptor_land().

◆ bomb2

entity bomb2

Definition at line 59 of file raptor.qc.