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 500 of file raptor.qc.

501{
502 this.deadflag = DEAD_DEAD;
503 this.vehicle_exit(this, VHEF_NORMAL);
504 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, DMG_NOWEP, NULL);
505
506 this.alpha = -1;
508 this.effects = EF_NODRAW;
509 this.colormod = '0 0 0';
510 this.avelocity = '0 0 0';
511 this.velocity = '0 0 0';
512
513 setorigin(this, this.pos1);
514 settouch(this, func_null);
515 this.nextthink = 0;
516}
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:981
#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

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 518 of file raptor.qc.

519{
520 if(time >= this.wait)
521 {
522 raptor_blowup(this, NULL);
523 return;
524 }
525
526 if(random() < 0.05)
527 {
528 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
529 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
530 }
531 this.nextthink = time;
532
534}
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:124
float random(void)
vector randomvec(void)
void raptor_blowup(entity this, entity toucher)
Definition raptor.qc:500
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 90 of file raptor.qc.

91{
92 entity player = this.owner;
93
94 this.tur_head.exteriormodeltoclient = NULL;
95
96 if(!IS_DEAD(this))
97 {
98 setthink(this, raptor_land);
99 this.nextthink = time;
100 }
101
102 if(!player)
103 return;
104
105 makevectors(this.angles);
106 vector spot;
107 if(eject)
108 {
109 spot = this.origin + v_forward * 100 + '0 0 64';
110 spot = vehicles_findgoodexit(this, player, spot);
111 setorigin(player, spot);
112 player.velocity = (v_up + v_forward * 0.25) * 750;
113 player.oldvelocity = player.velocity;
114 }
115 else
116 {
117 if(vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed))
118 {
119 player.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2;
120 player.velocity_z += 200;
121 spot = this.origin + v_forward * 32 + '0 0 64';
122 spot = vehicles_findgoodexit(this, player, spot);
123 }
124 else
125 {
126 player.velocity = this.velocity * 0.5;
127 player.velocity_z += 10;
128 spot = this.origin - v_forward * 200 + '0 0 64';
129 spot = vehicles_findgoodexit(this, player, spot);
130 }
131 player.oldvelocity = player.velocity;
132 setorigin(player, spot);
133 }
134
135 this.owner = NULL;
136 antilag_clear(player, CS(player));
137}
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:245
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:63
#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 139 of file raptor.qc.

140{
141 entity vehic = this.vehicle;
142 return = true;
143
144 if(game_stopped)
145 {
146 vehic.solid = SOLID_NOT;
147 vehic.takedamage = DAMAGE_NO;
149 return;
150 }
151
152 vehicles_frame(vehic, this);
153
154 /*
155 ftmp = vlen(vehic.velocity);
156 if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
157 ftmp = 1;
158 else
159 ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
160 */
161
162 if(vehic.sound_nexttime < time)
163 {
164 vehic.sound_nexttime = time + 7.955812;
165 //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
166 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
167 vehic.wait = 0;
168 }
169 /*
170 else if(fabs(ftmp - vehic.wait) > 0.2)
171 {
172 sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
173 sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
174 vehic.wait = ftmp;
175 }
176 */
177
178 if(IS_DEAD(vehic))
179 {
181 return;
182 }
183 crosshair_trace(this);
184
185 //if(time - vehic.lastteleporttime < 1)
186 //{
187 if(vehic.angles_z > 50 || vehic.angles_z < -50)
188 {
189 if(PHYS_INPUT_BUTTON_JUMP(this))
190 {
191 PHYS_INPUT_BUTTON_CROUCH(this) = true;
192 PHYS_INPUT_BUTTON_JUMP(this) = false;
193 }
194 }
195 //}
196
197 vector vang;
198 vang = vehic.angles;
199 vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
200 vang_x *= -1;
201 df_x *= -1;
202 if(df_x > 180) df_x -= 360;
203 if(df_x < -180) df_x += 360;
204 if(df_y > 180) df_y -= 360;
205 if(df_y < -180) df_y += 360;
206
207 float ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
208 if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
209 vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
210
211 // Pitch
212 ftmp = 0;
213 if(CS(this).movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
214 else if(CS(this).movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
215
218 vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
219
220 vehic.angles_x = anglemods(vehic.angles_x);
221 vehic.angles_y = anglemods(vehic.angles_y);
222 vehic.angles_z = anglemods(vehic.angles_z);
223
225 makevectors('0 1 0' * vehic.angles_y);
226 else
227 makevectors(this.v_angle);
228
229 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
230
231 if(CS(this).movement_x != 0)
232 {
233 if(CS(this).movement_x > 0)
235 else if(CS(this).movement_x < 0)
237 }
238
239 if(CS(this).movement_y != 0)
240 {
241 if(CS(this).movement_y < 0)
243 else if(CS(this).movement_y > 0)
245
246 vehic.angles_z = bound(-30,vehic.angles_z + (CS(this).movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
247 }
248 else
249 {
250 vehic.angles_z *= 0.95;
251 if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
252 vehic.angles_z = 0;
253 }
254
257 else if (PHYS_INPUT_BUTTON_JUMP(this))
259
260 vehic.velocity += df * dt;
261 this.velocity = CS(this).movement = vehic.velocity;
262 setorigin(this, vehic.origin + '0 0 32');
263 this.oldorigin = this.origin; // negate fall damage
264
265 STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
266
267 vector vf, ad;
268 // Target lock & predict
270 {
271 if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
272 vehic.gun1.enemy = NULL;
273
274 if(trace_ent)
275 if(trace_ent.move_movetype)
276 if(trace_ent.takedamage)
277 if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
278 {
279 if(teamplay)
280 {
281 if(trace_ent.team != this.team)
282 {
283 vehic.gun1.enemy = trace_ent;
284 vehic.gun1.lock_time = time + 5;
285 }
286 }
287 else
288 {
289 vehic.gun1.enemy = trace_ent;
290 vehic.gun1.lock_time = time + 0.5;
291 }
292 }
293
294 if(vehic.gun1.enemy)
295 {
296 float distance, impact_time;
297
298 vf = real_origin(vehic.gun1.enemy);
299 UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
300 vector _vel = vehic.gun1.enemy.velocity;
301 if(vehic.gun1.enemy.move_movetype == MOVETYPE_WALK)
302 _vel_z *= 0.1;
303
305 {
306 ad = vf;
307 distance = vlen(ad - this.origin);
308 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
309 ad = vf + _vel * impact_time;
310 trace_endpos = ad;
311 }
312 else
313 trace_endpos = vf;
314 }
315 }
317 {
318
322
323 if(vehic.lock_target != NULL)
325 if(vehic.lock_strength == 1)
326 {
327 float i, distance, impact_time;
328
329 vf = real_origin(vehic.lock_target);
330 ad = vf;
331 for(i = 0; i < 4; ++i)
332 {
333 distance = vlen(ad - vehic.origin);
334 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
335 ad = vf + vehic.lock_target.velocity * impact_time;
336 }
337 trace_endpos = ad;
338 }
339
340 if(vehic.lock_target)
341 {
342 if(vehic.lock_strength == 1)
343 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
344 else if(vehic.lock_strength > 0.5)
345 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
346 else if(vehic.lock_strength < 0.5)
347 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
348 }
349 }
350
351
352 vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
355
356 vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
359
360 /*
361 ad = ad * 0.5;
362 v_forward = vf * 0.5;
363 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
364 UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
365 */
366
367 Weapon wep1 = WEP_RAPTOR;
368 .entity weaponentity = weaponentities[0];
369 if(!weaponLocked(this) && !weaponUseForbidden(this))
370 if(PHYS_INPUT_BUTTON_ATCK(this))
371 if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
372 {
373 wep1.wr_think(wep1, vehic, weaponentity, 1);
374 }
375
376 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
378
379 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
381
382 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
384
385 Weapon wep2a = WEP_RAPTOR_BOMB;
386 if(!weaponLocked(this) && !weaponUseForbidden(this))
387 if(STAT(VEHICLESTAT_W2MODE, vehic) == RSM_BOMB)
388 {
391 {
392 .entity weaponentity = weaponentities[1];
393 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
395 vehic.lip = time;
396 }
397 }
398 else
399 {
400 Weapon wep2b = WEP_RAPTOR_FLARE;
403 {
404 .entity weaponentity = weaponentities[1];
405 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
407 vehic.lip = time;
408 }
409 }
410
411 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
412 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
413 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
414
415 if(vehic.bomb1.cnt < time)
416 {
417 bool incoming = false;
418 IL_EACH(g_projectiles, it.enemy == vehic,
419 {
420 if(it.missile_flags & MIF_GUIDED_TRACKING)
421 if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
422 {
423 incoming = true;
424 break;
425 }
426 });
427
428 if(incoming)
429 {
430 msg_entity = this;
431 soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE, 0);
432 }
433
434 vehic.bomb1.cnt = time + 1;
435 }
436
437
438 VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH);
439 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
440 if(vehic.vehicle_flags & VHF_HASSHIELD)
441 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
442
444}
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:44
virtual void wr_think()
(SERVER) logic to run every frame
Definition weapon.qh:90
virtual void wr_checkammo1()
(SERVER) checks ammo for weapon primary
Definition weapon.qh:92
#define PHYS_INPUT_BUTTON_CROUCH(s)
Definition player.qh:154
#define PHYS_INPUT_BUTTON_JUMP(s)
Definition player.qh:151
vector v_angle
Definition player.qh:237
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:150
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition player.qh:152
float game_stopped
Definition stats.qh:81
vector real_origin(entity ent)
Definition util.qc:148
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:52
float autocvar_g_vehicle_raptor_energy
Definition raptor.qc:44
float autocvar_g_vehicle_raptor_cannon_turnspeed
Definition raptor.qc:33
float autocvar_g_vehicle_raptor_cannon_pitchlimit_down
Definition raptor.qc:36
float autocvar_g_vehicle_raptor_health
Definition raptor.qc:48
float autocvar_g_vehicle_raptor_turnspeed
Definition raptor.qc:21
float autocvar_g_vehicle_raptor_cannon_locking_releasetime
Definition raptor.qc:40
float autocvar_g_vehicle_raptor_speed_up
Definition raptor.qc:27
float autocvar_g_vehicle_raptor_cannon_predicttarget
Definition raptor.qc:42
float autocvar_g_vehicle_raptor_energy_regen_pause
Definition raptor.qc:46
float autocvar_g_vehicle_raptor_pitchlimit
Definition raptor.qc:23
float autocvar_g_vehicle_raptor_health_regen_pause
Definition raptor.qc:50
int autocvar_g_vehicle_raptor_movestyle
Definition raptor.qc:20
float autocvar_g_vehicle_raptor_cannon_locking_time
Definition raptor.qc:39
float autocvar_g_vehicle_raptor_cannon_turnlimit
Definition raptor.qc:34
float autocvar_g_vehicle_raptor_speed_down
Definition raptor.qc:28
float autocvar_g_vehicle_raptor_shield_regen_pause
Definition raptor.qc:54
float autocvar_g_vehicle_raptor_energy_regen
Definition raptor.qc:45
float autocvar_g_vehicle_raptor_shield_regen
Definition raptor.qc:53
float autocvar_g_vehicle_raptor_cannon_locked_time
Definition raptor.qc:41
float autocvar_g_vehicle_raptor_speed_forward
Definition raptor.qc:25
float autocvar_g_vehicle_raptor_cannon_pitchlimit_up
Definition raptor.qc:35
float autocvar_g_vehicle_raptor_friction
Definition raptor.qc:29
float autocvar_g_vehicle_raptor_health_regen
Definition raptor.qc:49
float autocvar_g_vehicle_raptor_speed_strafe
Definition raptor.qc:26
bool autocvar_g_vehicle_raptor_cannon_locktarget
Definition raptor.qc:38
float autocvar_g_vehicle_raptor_pitchspeed
Definition raptor.qc:22
const int RSM_BOMB
Definition raptor.qh:27
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 energy left on vehicle. If ent is vehicle,...
const float vehicle_reload2
If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehicle,...
const float vehicle_health
const float vehicle_energy
If ent is player this is 0..100 indicating precentage of health left on vehicle. Vehicle's value is t...
#define VEHICLE_UPDATE_PLAYER(ply, vehi, fld, vhname)
#define VEHICLE_UPDATE_PLAYER_RESOURCE(ply, vehi, fld, vhname, res)
entity vehicle
Entity to disply the shild effect on damage.
const float vehicle_ammo2
If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehicle,...
bool teamplay
Definition teams.qh:59
void crosshair_trace(entity pl)
Definition tracing.qc:549
const int VHF_HASSHIELD
Indicates vehicle.
Definition vehicle.qh:85
const int VHF_HEALTHREGEN
Vehicles shield regenerates.
Definition vehicle.qh:87
const int VHF_ENERGYREGEN
Vehicles health regenerates.
Definition vehicle.qh:88
const int VHF_SHIELDREGEN
Vehicle has shileding.
Definition vehicle.qh:86
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, 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 545 of file raptor.qc.

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

64{
65 float hgt;
66
67 hgt = vehicle_altitude(this, 512);
68 this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME);
69 this.angles_x *= 0.95;
70 this.angles_z *= 0.95;
71
72 if(hgt < 128 && hgt > 0)
73 this.frame = (hgt / 128) * 25;
74
75 this.bomb1.gun1.avelocity_y = 90 + ((this.frame / 25) * 2000);
76 this.bomb1.gun2.avelocity_y = -this.bomb1.gun1.avelocity_y;
77
78 if(hgt < 16)
79 {
82 this.frame = 0;
83 }
84
85 this.nextthink = time;
86
88}
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
Definition anim.qh:6
#define PHYS_INPUT_FRAMETIME
Definition player.qh:255
const int MOVETYPE_TOSS
Definition movetypes.qh:135
entity bomb1
Definition raptor.qc:60
void vehicles_think(entity this)
float vehicle_altitude(entity this, float amax)
Definition vehicles.qc:4

References 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 538 of file raptor.qc.

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

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

◆ raptor_takeoff()

bool raptor_takeoff ( entity this,
float dt )

Definition at line 446 of file raptor.qc.

447{
448 entity vehic = this.vehicle;
449 return = true;
450
451 vehic.nextthink = time;
453 vehic.nextthink = 0; // will this work?
454
455 if(vehic.sound_nexttime < time)
456 {
457 vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
458 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
459 }
460
461 // Takeoff sequense
462 if(vehic.frame < 25)
463 {
464 vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / dt);
465 vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
466 vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
467 vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
469
470 setorigin(this, vehic.origin + '0 0 32');
471 this.oldorigin = this.origin;
472 }
473 else
474 this.PlayerPhysplug = raptor_frame;
475
476 STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic);
477
478 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
480
481 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
483
484 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
486
487
488 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
489 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
490 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
491
492 VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH);
493 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
494 if(vehic.vehicle_flags & VHF_HASSHIELD)
495 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
496
498}
float min(float f,...)
float autocvar_g_vehicle_raptor_takeofftime
Definition raptor.qc:16
bool raptor_frame(entity this, float dt)
Definition raptor.qc:139
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 588 of file raptor.qc.

589{
590 if(!autocvar_g_vehicle_raptor) { delete(this); return; }
591 if(!vehicle_initialize(this, VEH_RAPTOR, false)) { delete(this); return; }
592}
bool autocvar_g_vehicle_raptor
Definition raptor.qc:13
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 13 of file raptor.qc.

Referenced by spawnfunc().

◆ autocvar_g_vehicle_raptor_bouncefactor

float autocvar_g_vehicle_raptor_bouncefactor = 0.2

Definition at line 56 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_bouncepain

vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000'

Definition at line 58 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_bouncestop

float autocvar_g_vehicle_raptor_bouncestop = 0

Definition at line 57 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_cannon_locked_time

float autocvar_g_vehicle_raptor_cannon_locked_time = 1

Definition at line 41 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 40 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 39 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 38 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 36 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 35 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 42 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 34 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 33 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_energy

float autocvar_g_vehicle_raptor_energy = 100

Definition at line 44 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 45 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 46 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 29 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_health

float autocvar_g_vehicle_raptor_health = 250

Definition at line 48 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 49 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 50 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 20 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_pitchlimit

float autocvar_g_vehicle_raptor_pitchlimit = 45

Definition at line 23 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_pitchspeed

float autocvar_g_vehicle_raptor_pitchspeed = 50

Definition at line 22 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_respawntime

float autocvar_g_vehicle_raptor_respawntime = 40

Definition at line 15 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_shield

float autocvar_g_vehicle_raptor_shield = 200

Definition at line 52 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 53 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 54 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 28 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 25 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 26 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 27 of file raptor.qc.

Referenced by raptor_frame().

◆ autocvar_g_vehicle_raptor_swim

bool autocvar_g_vehicle_raptor_swim = false

Definition at line 31 of file raptor.qc.

◆ autocvar_g_vehicle_raptor_takeofftime

float autocvar_g_vehicle_raptor_takeofftime = 1.5

Definition at line 16 of file raptor.qc.

Referenced by raptor_takeoff().

◆ autocvar_g_vehicle_raptor_turnspeed

float autocvar_g_vehicle_raptor_turnspeed = 200

Definition at line 21 of file raptor.qc.

Referenced by raptor_frame().

◆ bomb1

entity bomb1

Definition at line 60 of file raptor.qc.

Referenced by raptor_land().

◆ bomb2

entity bomb2

Definition at line 61 of file raptor.qc.