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 this.tur_head.exteriormodeltoclient = NULL;
90 setthink(this, raptor_land);
91 this.nextthink = time;
97 makevectors(this.angles);
101 spot = this.origin + v_forward * 100 + '0 0 64';
102 spot = vehicles_findgoodexit(this, spot);
103 setorigin(this.owner , spot);
104 this.owner.velocity = (v_up + v_forward * 0.25) * 750;
105 this.owner.oldvelocity = this.owner.velocity;
109 if(vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed))
111 this.owner.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2;
112 this.owner.velocity_z += 200;
113 spot = this.origin + v_forward * 32 + '0 0 64';
114 spot = vehicles_findgoodexit(this, spot);
118 this.owner.velocity = this.velocity * 0.5;
119 this.owner.velocity_z += 10;
120 spot = this.origin - v_forward * 200 + '0 0 64';
121 spot = vehicles_findgoodexit(this, spot);
123 this.owner.oldvelocity = this.owner.velocity;
124 setorigin(this.owner , spot);
127 antilag_clear(this.owner, CS(this.owner));
131 bool raptor_frame(entity this, float dt)
133 entity vehic = this.vehicle;
136 if(intermission_running)
138 vehic.velocity = '0 0 0';
139 vehic.avelocity = '0 0 0';
143 vehicles_frame(vehic, this);
146 ftmp = vlen(vehic.velocity);
147 if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
150 ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
153 if(vehic.sound_nexttime < time)
155 vehic.sound_nexttime = time + 7.955812;
156 //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
157 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
161 else if(fabs(ftmp - vehic.wait) > 0.2)
163 sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
164 sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
171 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
174 crosshair_trace(this);
176 //if(time - vehic.lastteleporttime < 1)
178 if(vehic.angles_z > 50 || vehic.angles_z < -50)
180 if(PHYS_INPUT_BUTTON_JUMP(this))
182 PHYS_INPUT_BUTTON_CROUCH(this) = true;
183 PHYS_INPUT_BUTTON_JUMP(this) = false;
190 vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
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;
198 float ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
199 if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
200 vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
204 if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
205 else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
207 df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
208 ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
209 vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
211 vehic.angles_x = anglemods(vehic.angles_x);
212 vehic.angles_y = anglemods(vehic.angles_y);
213 vehic.angles_z = anglemods(vehic.angles_z);
215 if(autocvar_g_vehicle_raptor_movestyle == 1)
216 makevectors('0 1 0' * vehic.angles_y);
218 makevectors(this.v_angle);
220 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
222 if(this.movement_x != 0)
224 if(this.movement_x > 0)
225 df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
226 else if(this.movement_x < 0)
227 df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
230 if(this.movement_y != 0)
232 if(this.movement_y < 0)
233 df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
234 else if(this.movement_y > 0)
235 df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
237 vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
241 vehic.angles_z *= 0.95;
242 if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
246 if(PHYS_INPUT_BUTTON_CROUCH(this))
247 df -= v_up * autocvar_g_vehicle_raptor_speed_down;
248 else if (PHYS_INPUT_BUTTON_JUMP(this))
249 df += v_up * autocvar_g_vehicle_raptor_speed_up;
251 vehic.velocity += df * dt;
252 this.velocity = this.movement = vehic.velocity;
253 setorigin(this, vehic.origin + '0 0 32');
255 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
258 // Target lock & predict
259 if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
261 if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
262 vehic.gun1.enemy = NULL;
265 if(trace_ent.move_movetype)
266 if(trace_ent.takedamage)
267 if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
271 if(trace_ent.team != this.team)
273 vehic.gun1.enemy = trace_ent;
274 vehic.gun1.lock_time = time + 5;
279 vehic.gun1.enemy = trace_ent;
280 vehic.gun1.lock_time = time + 0.5;
286 float distance, impact_time;
288 vf = real_origin(vehic.gun1.enemy);
289 UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
290 vector _vel = vehic.gun1.enemy.velocity;
291 if(vehic.gun1.enemy.move_movetype == MOVETYPE_WALK)
294 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
297 distance = vlen(ad - this.origin);
298 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
299 ad = vf + _vel * impact_time;
306 else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
309 vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * dt,
310 (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * dt,
311 autocvar_g_vehicle_raptor_cannon_locked_time);
313 if(vehic.lock_target != NULL)
314 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
315 if(vehic.lock_strength == 1)
317 float i, distance, impact_time;
319 vf = real_origin(vehic.lock_target);
321 for(i = 0; i < 4; ++i)
323 distance = vlen(ad - vehic.origin);
324 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
325 ad = vf + vehic.lock_target.velocity * impact_time;
330 if(vehic.lock_target)
332 if(vehic.lock_strength == 1)
333 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
334 else if(vehic.lock_strength > 0.5)
335 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
336 else if(vehic.lock_strength < 0.5)
337 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
342 vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
343 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
344 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
346 vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
347 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
348 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
352 v_forward = vf * 0.5;
353 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
354 UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
357 Weapon wep1 = WEP_RAPTOR;
358 if(!forbidWeaponUse(this))
359 if(PHYS_INPUT_BUTTON_ATCK(this))
360 if (wep1.wr_checkammo1(wep1, vehic))
362 .entity weaponentity = weaponentities[0];
363 wep1.wr_think(wep1, vehic, weaponentity, 1);
366 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
367 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);
369 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
370 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);
372 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
373 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);
375 Weapon wep2a = WEP_RAPTOR_BOMB;
376 if(!forbidWeaponUse(this))
377 if(vehic.vehicle_weapon2mode == RSM_BOMB)
379 if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
380 if(PHYS_INPUT_BUTTON_ATCK2(this))
382 .entity weaponentity = weaponentities[1];
383 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
384 vehic.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
390 Weapon wep2b = WEP_RAPTOR_FLARE;
391 if(time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
392 if(PHYS_INPUT_BUTTON_ATCK2(this))
394 .entity weaponentity = weaponentities[1];
395 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
396 vehic.delay = time + autocvar_g_vehicle_raptor_flare_refire;
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;
405 if(vehic.bomb1.cnt < time)
407 bool incoming = false;
408 IL_EACH(g_projectiles, it.enemy == vehic,
410 if(MISSILE_IS_TRACKING(it))
411 if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
421 soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
424 vehic.bomb1.cnt = time + 1;
428 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
429 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
430 if(vehic.vehicle_flags & VHF_HASSHIELD)
431 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
433 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
436 bool raptor_takeoff(entity this, float dt)
438 entity vehic = this.vehicle;
441 vehic.nextthink = time;
442 CSQCMODEL_AUTOUPDATE(vehic);
443 vehic.nextthink = 0; // will this work?
445 if(vehic.sound_nexttime < time)
447 vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
448 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
454 vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / PHYS_INPUT_FRAMETIME);
455 vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
456 vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
457 vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
458 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
460 setorigin(this, vehic.origin + '0 0 32');
463 this.PlayerPhysplug = raptor_frame;
465 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
466 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);
468 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
469 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);
471 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
472 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);
475 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
476 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
477 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
479 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
480 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
481 if(vehic.vehicle_flags & VHF_HASSHIELD)
482 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
484 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
487 void raptor_blowup(entity this, entity toucher)
489 this.deadflag = DEAD_DEAD;
490 this.vehicle_exit(this, VHEF_NORMAL);
491 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL);
494 set_movetype(this, MOVETYPE_NONE);
495 this.effects = EF_NODRAW;
496 this.colormod = '0 0 0';
497 this.avelocity = '0 0 0';
498 this.velocity = '0 0 0';
500 setorigin(this, this.pos1);
501 settouch(this, func_null);
505 void raptor_diethink(entity this)
507 if(time >= this.wait)
509 raptor_blowup(this, NULL);
515 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
516 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
518 this.nextthink = time;
520 CSQCMODEL_AUTOUPDATE(this);
523 // If we dont do this ever now and then, the raptors rotors
524 // stop working, presumably due to angle overflow. cute.
525 void raptor_rotor_anglefix(entity this)
527 this.gun1.angles_y = anglemods(this.gun1.angles_y);
528 this.gun2.angles_y = anglemods(this.gun2.angles_y);
529 this.nextthink = time + 15;
532 bool raptor_impulse(entity this, int _imp)
536 case IMP_weapon_group_1.impulse:
537 this.vehicle.vehicle_weapon2mode = RSM_BOMB;
538 CSQCVehicleSetup(this, 0);
540 case IMP_weapon_group_2.impulse:
541 this.vehicle.vehicle_weapon2mode = RSM_FLARE;
542 CSQCVehicleSetup(this, 0);
545 case IMP_weapon_next_byid.impulse:
546 case IMP_weapon_next_bypriority.impulse:
547 case IMP_weapon_next_bygroup.impulse:
548 this.vehicle.vehicle_weapon2mode += 1;
549 if(this.vehicle.vehicle_weapon2mode > RSM_LAST)
550 this.vehicle.vehicle_weapon2mode = RSM_FIRST;
552 CSQCVehicleSetup(this, 0);
554 case IMP_weapon_last.impulse:
555 case IMP_weapon_prev_byid.impulse:
556 case IMP_weapon_prev_bypriority.impulse:
557 case IMP_weapon_prev_bygroup.impulse:
558 this.vehicle.vehicle_weapon2mode -= 1;
559 if(this.vehicle.vehicle_weapon2mode < RSM_FIRST)
560 this.vehicle.vehicle_weapon2mode = RSM_LAST;
562 CSQCVehicleSetup(this, 0);
566 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
568 case IMP_weapon_reload.impulse: // Manual minigun reload?
575 spawnfunc(vehicle_raptor)
577 if(!autocvar_g_vehicle_raptor) { delete(this); return; }
578 if(!vehicle_initialize(this, VEH_RAPTOR, false)) { delete(this); return; }
581 METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
583 if(autocvar_g_vehicle_raptor_bouncepain)
584 vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
586 METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
588 instance.vehicle_weapon2mode = RSM_BOMB;
589 instance.owner.PlayerPhysplug = raptor_takeoff;
590 set_movetype(instance, MOVETYPE_BOUNCEMISSILE);
591 instance.solid = SOLID_SLIDEBOX;
592 instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
593 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
594 instance.velocity = '0 0 1'; // nudge upwards so takeoff sequence can work
595 instance.tur_head.exteriormodeltoclient = instance.owner;
597 instance.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
600 if(instance.owner.flagcarried)
601 setorigin(instance.owner.flagcarried, '-20 0 96');
603 CSQCVehicleSetup(instance.owner, 0);
605 METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
608 instance.event_damage = func_null;
609 instance.solid = SOLID_CORPSE;
610 instance.takedamage = DAMAGE_NO;
611 instance.deadflag = DEAD_DYING;
612 set_movetype(instance, MOVETYPE_BOUNCE);
613 setthink(instance, raptor_diethink);
614 instance.nextthink = time;
615 instance.wait = time + 5 + (random() * 5);
617 Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
619 instance.velocity_z += 600;
621 instance.avelocity = '0 0.5 1' * (random() * 400);
622 instance.avelocity -= '0 0.5 1' * (random() * 400);
624 instance.colormod = '-0.5 -0.5 -0.5';
625 settouch(instance, raptor_blowup);
627 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
634 //FIXME: Camera is in a bad place in HUD model.
635 //setorigin(instance.vehicle_viewport, '25 0 5');
637 instance.vehicles_impulse = raptor_impulse;
641 instance.bomb1 = new(raptor_bomb);
642 instance.bomb2 = new(raptor_bomb);
643 instance.gun1 = new(raptor_gun);
644 instance.gun2 = new(raptor_gun);
646 setmodel(instance.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
647 setmodel(instance.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
648 setmodel(instance.gun1, MDL_VEH_RAPTOR_GUN);
649 setmodel(instance.gun2, MDL_VEH_RAPTOR_GUN);
650 setmodel(instance.tur_head, MDL_VEH_RAPTOR_TAIL);
652 setattachment(instance.bomb1, instance, "bombmount_left");
653 setattachment(instance.bomb2, instance, "bombmount_right");
654 setattachment(instance.tur_head, instance,"root");
656 // FIXMODEL Guns mounts to angled bones
657 instance.bomb1.angles = instance.angles;
658 instance.angles = '0 0 0';
659 // This messes up gun-aim, so work arround it.
660 //setattachment(instance.gun1, instance, "gunmount_left");
661 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_left"));
662 ofs -= instance.origin;
663 setattachment(instance.gun1, instance, "");
664 setorigin(instance.gun1, ofs);
666 //setattachment(instance.gun2, instance, "gunmount_right");
667 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_right"));
668 ofs -= instance.origin;
669 setattachment(instance.gun2, instance, "");
670 setorigin(instance.gun2, ofs);
672 instance.angles = instance.bomb1.angles;
673 instance.bomb1.angles = '0 0 0';
675 spinner = new(raptor_spinner);
676 spinner.owner = instance;
677 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
678 setattachment(spinner, instance, "engine_left");
679 set_movetype(spinner, MOVETYPE_NOCLIP);
680 spinner.avelocity = '0 90 0';
681 instance.bomb1.gun1 = spinner;
683 spinner = new(raptor_spinner);
684 spinner.owner = instance;
685 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
686 setattachment(spinner, instance, "engine_right");
687 set_movetype(spinner, MOVETYPE_NOCLIP);
688 spinner.avelocity = '0 -90 0';
689 instance.bomb1.gun2 = spinner;
692 setthink(instance.bomb1, raptor_rotor_anglefix);
693 instance.bomb1.nextthink = time;
699 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
700 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
701 set_movetype(instance, MOVETYPE_TOSS);
702 instance.solid = SOLID_SLIDEBOX;
703 instance.vehicle_energy = 1;
705 if(!autocvar_g_vehicle_raptor_swim)
706 instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
708 instance.PlayerPhysplug = raptor_frame;
710 instance.bomb1.gun1.avelocity_y = 90;
711 instance.bomb1.gun2.avelocity_y = -90;
713 instance.delay = time;
715 instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
716 instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
717 instance.damageforcescale = 0.25;
718 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
719 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
721 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
723 if(autocvar_g_vehicle_raptor_shield)
724 instance.vehicle_flags |= VHF_HASSHIELD;
726 if(autocvar_g_vehicle_raptor_shield_regen)
727 instance.vehicle_flags |= VHF_SHIELDREGEN;
729 if(autocvar_g_vehicle_raptor_health_regen)
730 instance.vehicle_flags |= VHF_HEALTHREGEN;
732 if(autocvar_g_vehicle_raptor_energy_regen)
733 instance.vehicle_flags |= VHF_ENERGYREGEN;
735 instance.vehicle_exit = raptor_exit;
736 instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
737 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
738 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
739 instance.max_health = instance.vehicle_health;
741 if(!autocvar_g_vehicle_raptor_swim)
742 instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
748 METHOD(Raptor, vr_hud, void(Raptor thisveh))
750 Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
751 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
752 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
754 METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player))
760 case RSM_FLARE: crosshair = vCROSS_RAIN; break;
761 case RSM_BOMB: crosshair = vCROSS_BURST; break;
762 default: crosshair = vCROSS_BURST;
765 vector tmpSize = '0 0 0';
766 if(weapon2mode != RSM_FLARE && !spectatee_status)
773 dropmark.owner = player;
774 dropmark.gravity = 1;
777 float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
780 setorigin(dropmark, pmove_org);
781 dropmark.velocity = pmove_vel;
782 tracetoss(dropmark, player);
784 where = project_3d_to_2d(trace_endpos);
786 setorigin(dropmark, trace_endpos);
787 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
789 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
791 where.x -= tmpSize.x * 0.5;
792 where.y -= tmpSize.y * 0.5;
794 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
795 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
797 dropmark.cnt = time + 5;
801 if(dropmark.cnt > time)
803 where = project_3d_to_2d(dropmark.origin);
804 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
806 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
808 where.x -= tmpSize.x * 0.5;
809 where.y -= tmpSize.y * 0.5;
811 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
812 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
818 Vehicles_drawCrosshair(crosshair);
820 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
822 AuxiliaryXhair[1].axh_image = vCROSS_LOCK;