5 #include "raptor_weapons.qh"
8 /* spawnflags */ ATTRIB(Raptor, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
9 /* mins */ ATTRIB(Raptor, mins, vector, '-80 -80 0');
10 /* maxs */ ATTRIB(Raptor, maxs, vector, '80 80 70');
11 /* view offset*/ ATTRIB(Raptor, view_ofs, vector, '0 0 160');
12 /* view dist */ ATTRIB(Raptor, height, float, 200);
13 /* model */ ATTRIB(Raptor, mdl, string, "models/vehicles/raptor.dpm");
14 /* model */ ATTRIB(Raptor, model, string, "models/vehicles/raptor.dpm");
15 /* head_model */ ATTRIB(Raptor, head_model, string, "");
16 /* hud_model */ ATTRIB(Raptor, hud_model, string, "models/vehicles/raptor_cockpit.dpm");
17 /* tags */ ATTRIB(Raptor, tag_head, string, "");
18 /* tags */ ATTRIB(Raptor, tag_hud, string, "tag_hud");
19 /* tags */ ATTRIB(Raptor, tag_view, string, "tag_camera");
20 /* netname */ ATTRIB(Raptor, netname, string, "raptor");
21 /* fullname */ ATTRIB(Raptor, vehicle_name, string, _("Raptor"));
22 /* icon */ ATTRIB(Raptor, m_icon, string, "vehicle_raptor");
24 REGISTER_VEHICLE(RAPTOR, NEW(Raptor));
32 bool autocvar_g_vehicle_raptor = true;
34 float autocvar_g_vehicle_raptor_respawntime = 40;
35 float autocvar_g_vehicle_raptor_takeofftime = 1.5;
37 // 0: go where player aims, +forward etc relative to aim angles
38 // 1: ignore aim for up/down movement. +forward always moved forward, +jump always moves up
39 int autocvar_g_vehicle_raptor_movestyle = 1;
40 float autocvar_g_vehicle_raptor_turnspeed = 200;
41 float autocvar_g_vehicle_raptor_pitchspeed = 50;
42 float autocvar_g_vehicle_raptor_pitchlimit = 45;
44 float autocvar_g_vehicle_raptor_speed_forward = 1700;
45 float autocvar_g_vehicle_raptor_speed_strafe = 900;
46 float autocvar_g_vehicle_raptor_speed_up = 1700;
47 float autocvar_g_vehicle_raptor_speed_down = 1700;
48 float autocvar_g_vehicle_raptor_friction = 2;
50 float autocvar_g_vehicle_raptor_cannon_turnspeed = 120;
51 float autocvar_g_vehicle_raptor_cannon_turnlimit = 20;
52 float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12;
53 float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32;
55 float autocvar_g_vehicle_raptor_cannon_locktarget = 0;
56 float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2;
57 float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45;
58 float autocvar_g_vehicle_raptor_cannon_locked_time = 1;
59 float autocvar_g_vehicle_raptor_cannon_predicttarget = 1;
61 float autocvar_g_vehicle_raptor_energy = 100;
62 float autocvar_g_vehicle_raptor_energy_regen = 25;
63 float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25;
65 float autocvar_g_vehicle_raptor_health = 150;
66 float autocvar_g_vehicle_raptor_health_regen = 0;
67 float autocvar_g_vehicle_raptor_health_regen_pause = 0;
69 float autocvar_g_vehicle_raptor_shield = 75;
70 float autocvar_g_vehicle_raptor_shield_regen = 25;
71 float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5;
73 float autocvar_g_vehicle_raptor_bouncefactor = 0.2;
74 float autocvar_g_vehicle_raptor_bouncestop = 0;
75 vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000';
80 float raptor_altitude(float amax)
82 tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), MOVE_WORLDONLY, self);
83 return vlen(self.origin - trace_endpos);
90 hgt = raptor_altitude(512);
91 self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
92 self.angles_x *= 0.95;
93 self.angles_z *= 0.95;
97 self.frame = (hgt / 128) * 25;
99 self.bomb1.gun1.avelocity_y = 90 + ((self.frame / 25) * 2000);
100 self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
104 self.movetype = MOVETYPE_TOSS;
105 self.think = vehicles_think;
109 self.nextthink = time;
111 CSQCMODEL_AUTOUPDATE(self);
114 void raptor_exit(float eject)
117 self.tur_head.exteriormodeltoclient = world;
121 self.think = raptor_land;
122 self.nextthink = time;
128 makevectors(self.angles);
131 spot = self.origin + v_forward * 100 + '0 0 64';
132 spot = vehicles_findgoodexit(spot);
133 setorigin(self.owner , spot);
134 self.owner.velocity = (v_up + v_forward * 0.25) * 750;
135 self.owner.oldvelocity = self.owner.velocity;
139 if(vdist(self.velocity, >, 2 * autocvar_sv_maxairspeed))
141 self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed * 2;
142 self.owner.velocity_z += 200;
143 spot = self.origin + v_forward * 32 + '0 0 64';
144 spot = vehicles_findgoodexit(spot);
148 self.owner.velocity = self.velocity * 0.5;
149 self.owner.velocity_z += 10;
150 spot = self.origin - v_forward * 200 + '0 0 64';
151 spot = vehicles_findgoodexit(spot);
153 self.owner.oldvelocity = self.owner.velocity;
154 setorigin(self.owner , spot);
157 antilag_clear(self.owner, CS(self.owner));
161 bool raptor_frame(entity this)
163 entity vehic = this.vehicle;
166 if(intermission_running)
168 vehic.velocity = '0 0 0';
169 vehic.avelocity = '0 0 0';
173 vehicles_frame(vehic, this);
177 ftmp = vlen(vehic.velocity);
178 if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
181 ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
184 if(vehic.sound_nexttime < time)
186 vehic.sound_nexttime = time + 7.955812;
187 //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
188 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
192 else if(fabs(ftmp - vehic.wait) > 0.2)
194 sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
195 sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
202 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
205 crosshair_trace(this);
207 //if(time - vehic.lastteleporttime < 1)
209 if(vehic.angles_z > 50 || vehic.angles_z < -50)
211 if(PHYS_INPUT_BUTTON_JUMP(this))
213 PHYS_INPUT_BUTTON_CROUCH(this) = true;
214 PHYS_INPUT_BUTTON_JUMP(this) = false;
221 vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
224 if(df_x > 180) df_x -= 360;
225 if(df_x < -180) df_x += 360;
226 if(df_y > 180) df_y -= 360;
227 if(df_y < -180) df_y += 360;
229 ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
230 if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
231 vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
235 if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
236 else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
238 df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
239 ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
240 vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
242 vehic.angles_x = anglemods(vehic.angles_x);
243 vehic.angles_y = anglemods(vehic.angles_y);
244 vehic.angles_z = anglemods(vehic.angles_z);
246 if(autocvar_g_vehicle_raptor_movestyle == 1)
247 makevectors('0 1 0' * vehic.angles_y);
249 makevectors(this.v_angle);
251 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
253 if(this.movement_x != 0)
255 if(this.movement_x > 0)
256 df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
257 else if(this.movement_x < 0)
258 df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
261 if(this.movement_y != 0)
263 if(this.movement_y < 0)
264 df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
265 else if(this.movement_y > 0)
266 df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
268 vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
272 vehic.angles_z *= 0.95;
273 if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
277 if(PHYS_INPUT_BUTTON_CROUCH(this))
278 df -= v_up * autocvar_g_vehicle_raptor_speed_down;
279 else if (PHYS_INPUT_BUTTON_JUMP(this))
280 df += v_up * autocvar_g_vehicle_raptor_speed_up;
282 vehic.velocity += df * frametime;
283 this.velocity = this.movement = vehic.velocity;
284 setorigin(this, vehic.origin + '0 0 32');
286 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
289 // Target lock & predict
290 if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
292 if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
293 vehic.gun1.enemy = world;
296 if(trace_ent.movetype)
297 if(trace_ent.takedamage)
298 if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
302 if(trace_ent.team != this.team)
304 vehic.gun1.enemy = trace_ent;
305 vehic.gun1.lock_time = time + 5;
310 vehic.gun1.enemy = trace_ent;
311 vehic.gun1.lock_time = time + 0.5;
317 float distance, impact_time;
319 vf = real_origin(vehic.gun1.enemy);
320 UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
321 vector _vel = vehic.gun1.enemy.velocity;
322 if(vehic.gun1.enemy.movetype == MOVETYPE_WALK)
325 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
328 distance = vlen(ad - this.origin);
329 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
330 ad = vf + _vel * impact_time;
337 else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
340 vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime,
341 (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * frametime,
342 autocvar_g_vehicle_raptor_cannon_locked_time);
344 if(vehic.lock_target != world)
345 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
346 if(vehic.lock_strength == 1)
348 float i, distance, impact_time;
350 vf = real_origin(vehic.lock_target);
352 for(i = 0; i < 4; ++i)
354 distance = vlen(ad - vehic.origin);
355 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
356 ad = vf + vehic.lock_target.velocity * impact_time;
361 if(vehic.lock_target)
363 if(vehic.lock_strength == 1)
364 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
365 else if(vehic.lock_strength > 0.5)
366 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
367 else if(vehic.lock_strength < 0.5)
368 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
373 vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
374 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
375 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
377 vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
378 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
379 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
383 v_forward = vf * 0.5;
384 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
385 UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
388 // TODO: fix wr_checkammo and its use of self!
391 Weapon wep1 = WEP_RAPTOR;
392 if(!forbidWeaponUse(this))
393 if(PHYS_INPUT_BUTTON_ATCK(this))
394 if (wep1.wr_checkammo1(wep1))
396 .entity weaponentity = weaponentities[0];
397 wep1.wr_think(wep1, vehic, weaponentity, 1);
400 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
401 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, frametime, true);
403 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
404 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, frametime, false);
406 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
407 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, frametime, false);
409 Weapon wep2a = WEP_RAPTOR_BOMB;
410 if(!forbidWeaponUse(this))
411 if(vehic.vehicle_weapon2mode == RSM_BOMB)
413 if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
414 if(PHYS_INPUT_BUTTON_ATCK2(this))
416 .entity weaponentity = weaponentities[1];
417 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
418 vehic.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
424 Weapon wep2b = WEP_RAPTOR_FLARE;
425 if(time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
426 if(PHYS_INPUT_BUTTON_ATCK2(this))
428 .entity weaponentity = weaponentities[1];
429 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
430 vehic.delay = time + autocvar_g_vehicle_raptor_flare_refire;
437 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
438 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
439 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
441 if(vehic.bomb1.cnt < time)
443 entity _missile = findchainentity(enemy, vehic);
444 float _incomming = 0;
447 if(_missile.flags & FL_PROJECTILE)
448 if(MISSILE_IS_TRACKING(_missile))
449 if(vdist(vehic.origin - _missile.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
452 _missile = _missile.chain;
456 sound(vehic, CH_PAIN_SINGLE, SND_VEH_MISSILE_ALARM, VOL_BASE, ATTEN_NONE);
458 vehic.bomb1.cnt = time + 1;
462 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
463 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
464 if(vehic.vehicle_flags & VHF_HASSHIELD)
465 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
467 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
470 bool raptor_takeoff(entity this)
472 entity vehic = this.vehicle;
475 vehic.nextthink = time;
476 CSQCMODEL_AUTOUPDATE(vehic);
477 vehic.nextthink = 0; // will this work?
479 if(vehic.sound_nexttime < time)
481 vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
482 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
488 vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime);
489 vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
490 vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
491 vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
492 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
494 setorigin(this, vehic.origin + '0 0 32');
497 this.PlayerPhysplug = raptor_frame;
499 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
500 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, frametime, true);
502 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
503 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, frametime, false);
505 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
506 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, frametime, false);
509 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
510 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
511 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
513 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
514 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
515 if(vehic.vehicle_flags & VHF_HASSHIELD)
516 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
518 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
523 self.deadflag = DEAD_DEAD;
524 self.vehicle_exit(VHEF_NORMAL);
525 RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH.m_id, world);
528 self.movetype = MOVETYPE_NONE;
529 self.effects = EF_NODRAW;
530 self.colormod = '0 0 0';
531 self.avelocity = '0 0 0';
532 self.velocity = '0 0 0';
534 setorigin(self, self.pos1);
535 self.touch = func_null;
539 void raptor_diethink()
541 if(time >= self.wait)
542 self.think = raptor_blowup;
546 sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
547 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
549 self.nextthink = time;
551 CSQCMODEL_AUTOUPDATE(self);
554 // If we dont do this ever now and then, the raptors rotors
555 // stop working, presumably due to angle overflow. cute.
556 void raptor_rotor_anglefix()
558 self.gun1.angles_y = anglemods(self.gun1.angles_y);
559 self.gun2.angles_y = anglemods(self.gun2.angles_y);
560 self.nextthink = time + 15;
563 float raptor_impulse(float _imp)
567 case IMP_weapon_group_1.impulse:
568 self.vehicle.vehicle_weapon2mode = RSM_BOMB;
569 CSQCVehicleSetup(self, 0);
571 case IMP_weapon_group_2.impulse:
572 self.vehicle.vehicle_weapon2mode = RSM_FLARE;
573 CSQCVehicleSetup(self, 0);
576 case IMP_weapon_next_byid.impulse:
577 case IMP_weapon_next_bypriority.impulse:
578 case IMP_weapon_next_bygroup.impulse:
579 self.vehicle.vehicle_weapon2mode += 1;
580 if(self.vehicle.vehicle_weapon2mode > RSM_LAST)
581 self.vehicle.vehicle_weapon2mode = RSM_FIRST;
583 CSQCVehicleSetup(self, 0);
585 case IMP_weapon_last.impulse:
586 case IMP_weapon_prev_byid.impulse:
587 case IMP_weapon_prev_bypriority.impulse:
588 case IMP_weapon_prev_bygroup.impulse:
589 self.vehicle.vehicle_weapon2mode -= 1;
590 if(self.vehicle.vehicle_weapon2mode < RSM_FIRST)
591 self.vehicle.vehicle_weapon2mode = RSM_LAST;
593 CSQCVehicleSetup(self, 0);
597 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
599 case IMP_weapon_reload.impulse: // Manual minigun reload?
606 spawnfunc(vehicle_raptor)
608 if(!autocvar_g_vehicle_raptor) { remove(this); return; }
609 if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; }
612 METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
614 if(autocvar_g_vehicle_raptor_bouncepain)
615 vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
617 METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
620 self.vehicle_weapon2mode = RSM_BOMB;
621 self.owner.PlayerPhysplug = raptor_takeoff;
622 self.movetype = MOVETYPE_BOUNCEMISSILE;
623 self.solid = SOLID_SLIDEBOX;
624 self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
625 self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
626 self.velocity_z = 1; // Nudge upwards to takeoff sequense can work.
627 self.tur_head.exteriormodeltoclient = self.owner;
629 self.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
632 if(self.owner.flagcarried)
633 setorigin(self.owner.flagcarried, '-20 0 96');
635 CSQCVehicleSetup(self.owner, 0);
637 METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
640 instance.event_damage = func_null;
641 instance.solid = SOLID_CORPSE;
642 instance.takedamage = DAMAGE_NO;
643 instance.deadflag = DEAD_DYING;
644 instance.movetype = MOVETYPE_BOUNCE;
645 instance.think = raptor_diethink;
646 instance.nextthink = time;
647 instance.wait = time + 5 + (random() * 5);
649 Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
651 instance.velocity_z += 600;
653 instance.avelocity = '0 0.5 1' * (random() * 400);
654 instance.avelocity -= '0 0.5 1' * (random() * 400);
656 instance.colormod = '-0.5 -0.5 -0.5';
657 instance.touch = raptor_blowup;
659 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
667 //FIXME: Camera is in a bad place in HUD model.
668 //setorigin(self.vehicle_viewport, '25 0 5');
670 self.vehicles_impulse = raptor_impulse;
674 self.bomb1 = new(raptor_bomb);
675 self.bomb2 = new(raptor_bomb);
676 self.gun1 = new(raptor_gun);
677 self.gun2 = new(raptor_gun);
679 setmodel(self.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
680 setmodel(self.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
681 setmodel(self.gun1, MDL_VEH_RAPTOR_GUN);
682 setmodel(self.gun2, MDL_VEH_RAPTOR_GUN);
683 setmodel(self.tur_head, MDL_VEH_RAPTOR_TAIL);
685 setattachment(self.bomb1, self, "bombmount_left");
686 setattachment(self.bomb2, self, "bombmount_right");
687 setattachment(self.tur_head, self,"root");
689 // FIXMODEL Guns mounts to angled bones
690 self.bomb1.angles = self.angles;
691 self.angles = '0 0 0';
692 // This messes up gun-aim, so work arround it.
693 //setattachment(self.gun1, self, "gunmount_left");
694 ofs = gettaginfo(self, gettagindex(self, "gunmount_left"));
696 setattachment(self.gun1, self, "");
697 setorigin(self.gun1, ofs);
699 //setattachment(self.gun2, self, "gunmount_right");
700 ofs = gettaginfo(self, gettagindex(self, "gunmount_right"));
702 setattachment(self.gun2, self, "");
703 setorigin(self.gun2, ofs);
705 self.angles = self.bomb1.angles;
706 self.bomb1.angles = '0 0 0';
708 spinner = new(raptor_spinner);
709 spinner.owner = self;
710 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
711 setattachment(spinner, self, "engine_left");
712 spinner.movetype = MOVETYPE_NOCLIP;
713 spinner.avelocity = '0 90 0';
714 self.bomb1.gun1 = spinner;
716 spinner = new(raptor_spinner);
717 spinner.owner = self;
718 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
719 setattachment(spinner, self, "engine_right");
720 spinner.movetype = MOVETYPE_NOCLIP;
721 spinner.avelocity = '0 -90 0';
722 self.bomb1.gun2 = spinner;
725 self.bomb1.think = raptor_rotor_anglefix;
726 self.bomb1.nextthink = time;
732 self.vehicle_health = autocvar_g_vehicle_raptor_health;
733 self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
734 self.movetype = MOVETYPE_TOSS;
735 self.solid = SOLID_SLIDEBOX;
736 self.vehicle_energy = 1;
738 self.PlayerPhysplug = raptor_frame;
740 self.bomb1.gun1.avelocity_y = 90;
741 self.bomb1.gun2.avelocity_y = -90;
745 self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
746 self.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
747 self.damageforcescale = 0.25;
748 self.vehicle_health = autocvar_g_vehicle_raptor_health;
749 self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
751 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
753 if(autocvar_g_vehicle_raptor_shield)
754 instance.vehicle_flags |= VHF_HASSHIELD;
756 if(autocvar_g_vehicle_raptor_shield_regen)
757 instance.vehicle_flags |= VHF_SHIELDREGEN;
759 if(autocvar_g_vehicle_raptor_health_regen)
760 instance.vehicle_flags |= VHF_HEALTHREGEN;
762 if(autocvar_g_vehicle_raptor_energy_regen)
763 instance.vehicle_flags |= VHF_ENERGYREGEN;
765 instance.vehicle_exit = raptor_exit;
766 instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
767 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
768 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
769 instance.max_health = instance.vehicle_health;
775 METHOD(Raptor, vr_hud, void(Raptor thisveh))
777 Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
778 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
779 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
781 METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
788 case RSM_FLARE: crosshair = vCROSS_RAIN; break;
789 case RSM_BOMB: crosshair = vCROSS_BURST; break;
790 default: crosshair = vCROSS_BURST;
793 vector tmpSize = '0 0 0';
794 if(weapon2mode != RSM_FLARE)
801 dropmark.owner = self;
802 dropmark.gravity = 1;
805 float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
808 setorigin(dropmark, pmove_org);
809 dropmark.velocity = pmove_vel;
810 tracetoss(dropmark, self);
812 where = project_3d_to_2d(trace_endpos);
814 setorigin(dropmark, trace_endpos);
815 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
817 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
819 where.x -= tmpSize.x * 0.5;
820 where.y -= tmpSize.y * 0.5;
822 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
823 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
825 dropmark.cnt = time + 5;
829 if(dropmark.cnt > time)
831 where = project_3d_to_2d(dropmark.origin);
832 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
834 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
836 where.x -= tmpSize.x * 0.5;
837 where.y -= tmpSize.y * 0.5;
839 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
840 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
846 Vehicles_drawCrosshair(crosshair);
848 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
850 AuxiliaryXhair[1].axh_image = vCROSS_LOCK;