7 bool autocvar_g_vehicle_raptor = true;
9 float autocvar_g_vehicle_raptor_respawntime = 40;
10 float autocvar_g_vehicle_raptor_takeofftime = 1.5;
12 // 0: go where player aims, +forward etc relative to aim angles
13 // 1: ignore aim for up/down movement. +forward always moved forward, +jump always moves up
14 int autocvar_g_vehicle_raptor_movestyle = 1;
15 float autocvar_g_vehicle_raptor_turnspeed = 200;
16 float autocvar_g_vehicle_raptor_pitchspeed = 50;
17 float autocvar_g_vehicle_raptor_pitchlimit = 45;
19 float autocvar_g_vehicle_raptor_speed_forward = 1700;
20 float autocvar_g_vehicle_raptor_speed_strafe = 900;
21 float autocvar_g_vehicle_raptor_speed_up = 1700;
22 float autocvar_g_vehicle_raptor_speed_down = 1700;
23 float autocvar_g_vehicle_raptor_friction = 2;
25 bool autocvar_g_vehicle_raptor_swim = false;
27 float autocvar_g_vehicle_raptor_cannon_turnspeed = 120;
28 float autocvar_g_vehicle_raptor_cannon_turnlimit = 20;
29 float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12;
30 float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32;
32 float autocvar_g_vehicle_raptor_cannon_locktarget = 0;
33 float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2;
34 float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45;
35 float autocvar_g_vehicle_raptor_cannon_locked_time = 1;
36 float autocvar_g_vehicle_raptor_cannon_predicttarget = 1;
38 float autocvar_g_vehicle_raptor_energy = 100;
39 float autocvar_g_vehicle_raptor_energy_regen = 25;
40 float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25;
42 float autocvar_g_vehicle_raptor_health = 150;
43 float autocvar_g_vehicle_raptor_health_regen = 0;
44 float autocvar_g_vehicle_raptor_health_regen_pause = 0;
46 float autocvar_g_vehicle_raptor_shield = 75;
47 float autocvar_g_vehicle_raptor_shield_regen = 25;
48 float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5;
50 float autocvar_g_vehicle_raptor_bouncefactor = 0.2;
51 float autocvar_g_vehicle_raptor_bouncestop = 0;
52 vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000';
57 void raptor_land(entity this)
61 hgt = vehicle_altitude(this, 512);
62 this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME);
63 this.angles_x *= 0.95;
64 this.angles_z *= 0.95;
66 if(hgt < 128 && hgt > 0)
67 this.frame = (hgt / 128) * 25;
69 this.bomb1.gun1.avelocity_y = 90 + ((this.frame / 25) * 2000);
70 this.bomb1.gun2.avelocity_y = -this.bomb1.gun1.avelocity_y;
74 set_movetype(this, MOVETYPE_TOSS);
75 setthink(this, vehicles_think);
79 this.nextthink = time;
81 CSQCMODEL_AUTOUPDATE(this);
84 void raptor_exit(entity this, int eject)
86 entity player = this.owner;
89 this.tur_head.exteriormodeltoclient = NULL;
93 setthink(this, raptor_land);
94 this.nextthink = time;
100 makevectors(this.angles);
104 spot = this.origin + v_forward * 100 + '0 0 64';
105 spot = vehicles_findgoodexit(this, spot);
106 setorigin(player, spot);
107 player.velocity = (v_up + v_forward * 0.25) * 750;
108 player.oldvelocity = player.velocity;
112 if(vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed))
114 player.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2;
115 player.velocity_z += 200;
116 spot = this.origin + v_forward * 32 + '0 0 64';
117 spot = vehicles_findgoodexit(this, spot);
121 player.velocity = this.velocity * 0.5;
122 player.velocity_z += 10;
123 spot = this.origin - v_forward * 200 + '0 0 64';
124 spot = vehicles_findgoodexit(this, spot);
126 player.oldvelocity = player.velocity;
127 setorigin(player, spot);
130 antilag_clear(player, CS(player));
133 bool raptor_frame(entity this, float dt)
135 entity vehic = this.vehicle;
140 vehic.solid = SOLID_NOT;
141 vehic.takedamage = DAMAGE_NO;
142 set_movetype(vehic, MOVETYPE_NONE);
146 vehicles_frame(vehic, this);
149 ftmp = vlen(vehic.velocity);
150 if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
153 ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
156 if(vehic.sound_nexttime < time)
158 vehic.sound_nexttime = time + 7.955812;
159 //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
160 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
164 else if(fabs(ftmp - vehic.wait) > 0.2)
166 sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
167 sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
174 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
177 crosshair_trace(this);
179 //if(time - vehic.lastteleporttime < 1)
181 if(vehic.angles_z > 50 || vehic.angles_z < -50)
183 if(PHYS_INPUT_BUTTON_JUMP(this))
185 PHYS_INPUT_BUTTON_CROUCH(this) = true;
186 PHYS_INPUT_BUTTON_JUMP(this) = false;
193 vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
196 if(df_x > 180) df_x -= 360;
197 if(df_x < -180) df_x += 360;
198 if(df_y > 180) df_y -= 360;
199 if(df_y < -180) df_y += 360;
201 float ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
202 if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
203 vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
207 if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
208 else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
210 df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
211 ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
212 vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
214 vehic.angles_x = anglemods(vehic.angles_x);
215 vehic.angles_y = anglemods(vehic.angles_y);
216 vehic.angles_z = anglemods(vehic.angles_z);
218 if(autocvar_g_vehicle_raptor_movestyle == 1)
219 makevectors('0 1 0' * vehic.angles_y);
221 makevectors(this.v_angle);
223 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
225 if(this.movement_x != 0)
227 if(this.movement_x > 0)
228 df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
229 else if(this.movement_x < 0)
230 df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
233 if(this.movement_y != 0)
235 if(this.movement_y < 0)
236 df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
237 else if(this.movement_y > 0)
238 df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
240 vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
244 vehic.angles_z *= 0.95;
245 if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
249 if(PHYS_INPUT_BUTTON_CROUCH(this))
250 df -= v_up * autocvar_g_vehicle_raptor_speed_down;
251 else if (PHYS_INPUT_BUTTON_JUMP(this))
252 df += v_up * autocvar_g_vehicle_raptor_speed_up;
254 vehic.velocity += df * dt;
255 this.velocity = this.movement = vehic.velocity;
256 setorigin(this, vehic.origin + '0 0 32');
258 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
261 // Target lock & predict
262 if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
264 if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
265 vehic.gun1.enemy = NULL;
268 if(trace_ent.move_movetype)
269 if(trace_ent.takedamage)
270 if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
274 if(trace_ent.team != this.team)
276 vehic.gun1.enemy = trace_ent;
277 vehic.gun1.lock_time = time + 5;
282 vehic.gun1.enemy = trace_ent;
283 vehic.gun1.lock_time = time + 0.5;
289 float distance, impact_time;
291 vf = real_origin(vehic.gun1.enemy);
292 UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
293 vector _vel = vehic.gun1.enemy.velocity;
294 if(vehic.gun1.enemy.move_movetype == MOVETYPE_WALK)
297 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
300 distance = vlen(ad - this.origin);
301 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
302 ad = vf + _vel * impact_time;
309 else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
312 vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * dt,
313 (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * dt,
314 autocvar_g_vehicle_raptor_cannon_locked_time);
316 if(vehic.lock_target != NULL)
317 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
318 if(vehic.lock_strength == 1)
320 float i, distance, impact_time;
322 vf = real_origin(vehic.lock_target);
324 for(i = 0; i < 4; ++i)
326 distance = vlen(ad - vehic.origin);
327 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
328 ad = vf + vehic.lock_target.velocity * impact_time;
333 if(vehic.lock_target)
335 if(vehic.lock_strength == 1)
336 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
337 else if(vehic.lock_strength > 0.5)
338 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
339 else if(vehic.lock_strength < 0.5)
340 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
345 vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
346 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
347 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
349 vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
350 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
351 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
355 v_forward = vf * 0.5;
356 traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
357 UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
360 Weapon wep1 = WEP_RAPTOR;
361 .entity weaponentity = weaponentities[0];
362 if(!forbidWeaponUse(this))
363 if(PHYS_INPUT_BUTTON_ATCK(this))
364 if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
366 wep1.wr_think(wep1, vehic, weaponentity, 1);
369 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
370 vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true);
372 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
373 vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false);
375 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
376 vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt, false);
378 Weapon wep2a = WEP_RAPTOR_BOMB;
379 if(!forbidWeaponUse(this))
380 if(vehic.vehicle_weapon2mode == RSM_BOMB)
382 if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
383 if(PHYS_INPUT_BUTTON_ATCK2(this))
385 .entity weaponentity = weaponentities[1];
386 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
387 vehic.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
393 Weapon wep2b = WEP_RAPTOR_FLARE;
394 if(time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
395 if(PHYS_INPUT_BUTTON_ATCK2(this))
397 .entity weaponentity = weaponentities[1];
398 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
399 vehic.delay = time + autocvar_g_vehicle_raptor_flare_refire;
404 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
405 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
406 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
408 if(vehic.bomb1.cnt < time)
410 bool incoming = false;
411 IL_EACH(g_projectiles, it.enemy == vehic,
413 if(MISSILE_IS_TRACKING(it))
414 if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
424 soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
427 vehic.bomb1.cnt = time + 1;
431 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
432 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
433 if(vehic.vehicle_flags & VHF_HASSHIELD)
434 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
436 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
439 bool raptor_takeoff(entity this, float dt)
441 entity vehic = this.vehicle;
444 vehic.nextthink = time;
445 CSQCMODEL_AUTOUPDATE(vehic);
446 vehic.nextthink = 0; // will this work?
448 if(vehic.sound_nexttime < time)
450 vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
451 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
457 vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / PHYS_INPUT_FRAMETIME);
458 vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
459 vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
460 vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
461 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
463 setorigin(this, vehic.origin + '0 0 32');
466 this.PlayerPhysplug = raptor_frame;
468 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
470 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
471 vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true);
473 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
474 vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false);
476 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
477 vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt, false);
480 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
481 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
482 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
484 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
485 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
486 if(vehic.vehicle_flags & VHF_HASSHIELD)
487 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
489 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
492 void raptor_blowup(entity this, entity toucher)
494 this.deadflag = DEAD_DEAD;
495 this.vehicle_exit(this, VHEF_NORMAL);
496 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL);
499 set_movetype(this, MOVETYPE_NONE);
500 this.effects = EF_NODRAW;
501 this.colormod = '0 0 0';
502 this.avelocity = '0 0 0';
503 this.velocity = '0 0 0';
505 setorigin(this, this.pos1);
506 settouch(this, func_null);
510 void raptor_diethink(entity this)
512 if(time >= this.wait)
514 raptor_blowup(this, NULL);
520 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
521 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
523 this.nextthink = time;
525 CSQCMODEL_AUTOUPDATE(this);
528 // If we dont do this ever now and then, the raptors rotors
529 // stop working, presumably due to angle overflow. cute.
530 void raptor_rotor_anglefix(entity this)
532 this.gun1.angles_y = anglemods(this.gun1.angles_y);
533 this.gun2.angles_y = anglemods(this.gun2.angles_y);
534 this.nextthink = time + 15;
537 bool raptor_impulse(entity this, int _imp)
541 case IMP_weapon_group_1.impulse:
542 this.vehicle.vehicle_weapon2mode = RSM_BOMB;
543 CSQCVehicleSetup(this, 0);
545 case IMP_weapon_group_2.impulse:
546 this.vehicle.vehicle_weapon2mode = RSM_FLARE;
547 CSQCVehicleSetup(this, 0);
550 case IMP_weapon_next_byid.impulse:
551 case IMP_weapon_next_bypriority.impulse:
552 case IMP_weapon_next_bygroup.impulse:
553 this.vehicle.vehicle_weapon2mode += 1;
554 if(this.vehicle.vehicle_weapon2mode > RSM_LAST)
555 this.vehicle.vehicle_weapon2mode = RSM_FIRST;
557 CSQCVehicleSetup(this, 0);
559 case IMP_weapon_last.impulse:
560 case IMP_weapon_prev_byid.impulse:
561 case IMP_weapon_prev_bypriority.impulse:
562 case IMP_weapon_prev_bygroup.impulse:
563 this.vehicle.vehicle_weapon2mode -= 1;
564 if(this.vehicle.vehicle_weapon2mode < RSM_FIRST)
565 this.vehicle.vehicle_weapon2mode = RSM_LAST;
567 CSQCVehicleSetup(this, 0);
571 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
573 case IMP_weapon_reload.impulse: // Manual minigun reload?
580 spawnfunc(vehicle_raptor)
582 if(!autocvar_g_vehicle_raptor) { delete(this); return; }
583 if(!vehicle_initialize(this, VEH_RAPTOR, false)) { delete(this); return; }
586 METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
588 if(autocvar_g_vehicle_raptor_bouncepain)
589 vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
591 METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
593 instance.vehicle_weapon2mode = RSM_BOMB;
594 instance.owner.PlayerPhysplug = raptor_takeoff;
595 set_movetype(instance, MOVETYPE_BOUNCEMISSILE);
596 instance.solid = SOLID_SLIDEBOX;
597 instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
598 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
599 instance.velocity = '0 0 1'; // nudge upwards so takeoff sequence can work
600 instance.tur_head.exteriormodeltoclient = instance.owner;
602 instance.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
605 if(instance.owner.flagcarried)
606 setorigin(instance.owner.flagcarried, '-20 0 96');
608 CSQCVehicleSetup(instance.owner, 0);
610 METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
613 instance.event_damage = func_null;
614 instance.solid = SOLID_CORPSE;
615 instance.takedamage = DAMAGE_NO;
616 instance.deadflag = DEAD_DYING;
617 set_movetype(instance, MOVETYPE_BOUNCE);
618 setthink(instance, raptor_diethink);
619 instance.nextthink = time;
620 instance.wait = time + 5 + (random() * 5);
622 Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
624 instance.velocity_z += 600;
626 instance.avelocity = '0 0.5 1' * (random() * 400);
627 instance.avelocity -= '0 0.5 1' * (random() * 400);
629 instance.colormod = '-0.5 -0.5 -0.5';
630 settouch(instance, raptor_blowup);
632 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
639 //FIXME: Camera is in a bad place in HUD model.
640 //setorigin(instance.vehicle_viewport, '25 0 5');
642 instance.vehicles_impulse = raptor_impulse;
646 instance.bomb1 = new(raptor_bomb);
647 instance.bomb2 = new(raptor_bomb);
648 instance.gun1 = new(raptor_gun);
649 instance.gun2 = new(raptor_gun);
651 setmodel(instance.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
652 setmodel(instance.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
653 setmodel(instance.gun1, MDL_VEH_RAPTOR_GUN);
654 setmodel(instance.gun2, MDL_VEH_RAPTOR_GUN);
655 setmodel(instance.tur_head, MDL_VEH_RAPTOR_TAIL);
657 setattachment(instance.bomb1, instance, "bombmount_left");
658 setattachment(instance.bomb2, instance, "bombmount_right");
659 setattachment(instance.tur_head, instance,"root");
661 // FIXMODEL Guns mounts to angled bones
662 instance.bomb1.angles = instance.angles;
663 instance.angles = '0 0 0';
664 // This messes up gun-aim, so work arround it.
665 //setattachment(instance.gun1, instance, "gunmount_left");
666 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_left"));
667 ofs -= instance.origin;
668 setattachment(instance.gun1, instance, "");
669 setorigin(instance.gun1, ofs);
671 //setattachment(instance.gun2, instance, "gunmount_right");
672 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_right"));
673 ofs -= instance.origin;
674 setattachment(instance.gun2, instance, "");
675 setorigin(instance.gun2, ofs);
677 instance.angles = instance.bomb1.angles;
678 instance.bomb1.angles = '0 0 0';
680 spinner = new(raptor_spinner);
681 spinner.owner = instance;
682 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
683 setattachment(spinner, instance, "engine_left");
684 set_movetype(spinner, MOVETYPE_NOCLIP);
685 spinner.avelocity = '0 90 0';
686 instance.bomb1.gun1 = spinner;
688 spinner = new(raptor_spinner);
689 spinner.owner = instance;
690 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
691 setattachment(spinner, instance, "engine_right");
692 set_movetype(spinner, MOVETYPE_NOCLIP);
693 spinner.avelocity = '0 -90 0';
694 instance.bomb1.gun2 = spinner;
697 setthink(instance.bomb1, raptor_rotor_anglefix);
698 instance.bomb1.nextthink = time;
704 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
705 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
706 set_movetype(instance, MOVETYPE_TOSS);
707 instance.solid = SOLID_SLIDEBOX;
708 instance.vehicle_energy = 1;
710 if(!autocvar_g_vehicle_raptor_swim)
711 instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
713 instance.PlayerPhysplug = raptor_frame;
715 instance.bomb1.gun1.avelocity_y = 90;
716 instance.bomb1.gun2.avelocity_y = -90;
718 instance.delay = time;
720 instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
721 instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
722 instance.damageforcescale = 0.25;
723 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
724 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
726 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
728 if(autocvar_g_vehicle_raptor_shield)
729 instance.vehicle_flags |= VHF_HASSHIELD;
731 if(autocvar_g_vehicle_raptor_shield_regen)
732 instance.vehicle_flags |= VHF_SHIELDREGEN;
734 if(autocvar_g_vehicle_raptor_health_regen)
735 instance.vehicle_flags |= VHF_HEALTHREGEN;
737 if(autocvar_g_vehicle_raptor_energy_regen)
738 instance.vehicle_flags |= VHF_ENERGYREGEN;
740 instance.vehicle_exit = raptor_exit;
741 instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
742 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
743 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
744 instance.max_health = instance.vehicle_health;
746 if(!autocvar_g_vehicle_raptor_swim)
747 instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
753 METHOD(Raptor, vr_hud, void(Raptor thisveh))
755 Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
756 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
757 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
759 METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player))
765 case RSM_FLARE: crosshair = vCROSS_RAIN; break;
766 case RSM_BOMB: crosshair = vCROSS_BURST; break;
767 default: crosshair = vCROSS_BURST;
770 vector tmpSize = '0 0 0';
771 if(weapon2mode != RSM_FLARE && !spectatee_status)
778 dropmark.owner = player;
779 dropmark.gravity = 1;
782 float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
785 setorigin(dropmark, pmove_org);
786 dropmark.velocity = pmove_vel;
787 tracetoss(dropmark, player);
789 where = project_3d_to_2d(trace_endpos);
791 setorigin(dropmark, trace_endpos);
792 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
794 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
796 where.x -= tmpSize.x * 0.5;
797 where.y -= tmpSize.y * 0.5;
799 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
800 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
802 dropmark.cnt = time + 5;
806 if(dropmark.cnt > time)
808 where = project_3d_to_2d(dropmark.origin);
809 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
811 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
813 where.x -= tmpSize.x * 0.5;
814 where.y -= tmpSize.y * 0.5;
816 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
817 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
823 Vehicles_drawCrosshair(crosshair);
825 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
827 AuxiliaryXhair[1].axh_image = vCROSS_LOCK;