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 void raptor_land(entity this)
84 hgt = vehicle_altitude(this, 512);
85 this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
86 this.angles_x *= 0.95;
87 this.angles_z *= 0.95;
89 if(hgt < 128 && hgt > 0)
90 this.frame = (hgt / 128) * 25;
92 this.bomb1.gun1.avelocity_y = 90 + ((this.frame / 25) * 2000);
93 this.bomb1.gun2.avelocity_y = -this.bomb1.gun1.avelocity_y;
97 this.movetype = MOVETYPE_TOSS;
98 setthink(this, vehicles_think);
102 this.nextthink = time;
104 CSQCMODEL_AUTOUPDATE(this);
107 void raptor_exit(entity this, int eject)
109 this.tur_head.exteriormodeltoclient = NULL;
113 setthink(this, raptor_land);
114 this.nextthink = time;
120 makevectors(this.angles);
124 spot = this.origin + v_forward * 100 + '0 0 64';
125 spot = vehicles_findgoodexit(this, spot);
126 setorigin(this.owner , spot);
127 this.owner.velocity = (v_up + v_forward * 0.25) * 750;
128 this.owner.oldvelocity = this.owner.velocity;
132 if(vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed))
134 this.owner.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2;
135 this.owner.velocity_z += 200;
136 spot = this.origin + v_forward * 32 + '0 0 64';
137 spot = vehicles_findgoodexit(this, spot);
141 this.owner.velocity = this.velocity * 0.5;
142 this.owner.velocity_z += 10;
143 spot = this.origin - v_forward * 200 + '0 0 64';
144 spot = vehicles_findgoodexit(this, spot);
146 this.owner.oldvelocity = this.owner.velocity;
147 setorigin(this.owner , spot);
150 antilag_clear(this.owner, CS(this.owner));
154 bool raptor_frame(entity this)
156 entity vehic = this.vehicle;
159 if(intermission_running)
161 vehic.velocity = '0 0 0';
162 vehic.avelocity = '0 0 0';
166 vehicles_frame(vehic, this);
169 ftmp = vlen(vehic.velocity);
170 if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
173 ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
176 if(vehic.sound_nexttime < time)
178 vehic.sound_nexttime = time + 7.955812;
179 //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
180 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
184 else if(fabs(ftmp - vehic.wait) > 0.2)
186 sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
187 sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
194 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
197 crosshair_trace(this);
199 //if(time - vehic.lastteleporttime < 1)
201 if(vehic.angles_z > 50 || vehic.angles_z < -50)
203 if(PHYS_INPUT_BUTTON_JUMP(this))
205 PHYS_INPUT_BUTTON_CROUCH(this) = true;
206 PHYS_INPUT_BUTTON_JUMP(this) = false;
213 vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
216 if(df_x > 180) df_x -= 360;
217 if(df_x < -180) df_x += 360;
218 if(df_y > 180) df_y -= 360;
219 if(df_y < -180) df_y += 360;
221 float ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
222 if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
223 vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
227 if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
228 else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
230 df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
231 ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
232 vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
234 vehic.angles_x = anglemods(vehic.angles_x);
235 vehic.angles_y = anglemods(vehic.angles_y);
236 vehic.angles_z = anglemods(vehic.angles_z);
238 if(autocvar_g_vehicle_raptor_movestyle == 1)
239 makevectors('0 1 0' * vehic.angles_y);
241 makevectors(this.v_angle);
243 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
245 if(this.movement_x != 0)
247 if(this.movement_x > 0)
248 df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
249 else if(this.movement_x < 0)
250 df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
253 if(this.movement_y != 0)
255 if(this.movement_y < 0)
256 df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
257 else if(this.movement_y > 0)
258 df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
260 vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
264 vehic.angles_z *= 0.95;
265 if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
269 if(PHYS_INPUT_BUTTON_CROUCH(this))
270 df -= v_up * autocvar_g_vehicle_raptor_speed_down;
271 else if (PHYS_INPUT_BUTTON_JUMP(this))
272 df += v_up * autocvar_g_vehicle_raptor_speed_up;
274 vehic.velocity += df * frametime;
275 this.velocity = this.movement = vehic.velocity;
276 setorigin(this, vehic.origin + '0 0 32');
278 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
281 // Target lock & predict
282 if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
284 if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
285 vehic.gun1.enemy = NULL;
288 if(trace_ent.movetype)
289 if(trace_ent.takedamage)
290 if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
294 if(trace_ent.team != this.team)
296 vehic.gun1.enemy = trace_ent;
297 vehic.gun1.lock_time = time + 5;
302 vehic.gun1.enemy = trace_ent;
303 vehic.gun1.lock_time = time + 0.5;
309 float distance, impact_time;
311 vf = real_origin(vehic.gun1.enemy);
312 UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
313 vector _vel = vehic.gun1.enemy.velocity;
314 if(vehic.gun1.enemy.movetype == MOVETYPE_WALK)
317 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
320 distance = vlen(ad - this.origin);
321 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
322 ad = vf + _vel * impact_time;
329 else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
332 vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime,
333 (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * frametime,
334 autocvar_g_vehicle_raptor_cannon_locked_time);
336 if(vehic.lock_target != NULL)
337 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
338 if(vehic.lock_strength == 1)
340 float i, distance, impact_time;
342 vf = real_origin(vehic.lock_target);
344 for(i = 0; i < 4; ++i)
346 distance = vlen(ad - vehic.origin);
347 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
348 ad = vf + vehic.lock_target.velocity * impact_time;
353 if(vehic.lock_target)
355 if(vehic.lock_strength == 1)
356 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
357 else if(vehic.lock_strength > 0.5)
358 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
359 else if(vehic.lock_strength < 0.5)
360 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
365 vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
366 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
367 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
369 vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
370 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
371 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
375 v_forward = vf * 0.5;
376 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
377 UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
380 Weapon wep1 = WEP_RAPTOR;
381 if(!forbidWeaponUse(this))
382 if(PHYS_INPUT_BUTTON_ATCK(this))
383 if (wep1.wr_checkammo1(wep1, vehic))
385 .entity weaponentity = weaponentities[0];
386 wep1.wr_think(wep1, vehic, weaponentity, 1);
389 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
390 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);
392 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
393 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);
395 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
396 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);
398 Weapon wep2a = WEP_RAPTOR_BOMB;
399 if(!forbidWeaponUse(this))
400 if(vehic.vehicle_weapon2mode == RSM_BOMB)
402 if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
403 if(PHYS_INPUT_BUTTON_ATCK2(this))
405 .entity weaponentity = weaponentities[1];
406 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
407 vehic.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
413 Weapon wep2b = WEP_RAPTOR_FLARE;
414 if(time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
415 if(PHYS_INPUT_BUTTON_ATCK2(this))
417 .entity weaponentity = weaponentities[1];
418 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
419 vehic.delay = time + autocvar_g_vehicle_raptor_flare_refire;
424 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
425 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
426 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
428 if(vehic.bomb1.cnt < time)
430 bool incoming = false;
431 FOREACH_ENTITY_ENT(enemy, vehic,
433 if(it.flags & FL_PROJECTILE)
434 if(MISSILE_IS_TRACKING(it))
435 if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
445 soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
448 vehic.bomb1.cnt = time + 1;
452 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
453 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
454 if(vehic.vehicle_flags & VHF_HASSHIELD)
455 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
457 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
460 bool raptor_takeoff(entity this)
462 entity vehic = this.vehicle;
465 vehic.nextthink = time;
466 CSQCMODEL_AUTOUPDATE(vehic);
467 vehic.nextthink = 0; // will this work?
469 if(vehic.sound_nexttime < time)
471 vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
472 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
478 vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime);
479 vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
480 vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
481 vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
482 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
484 setorigin(this, vehic.origin + '0 0 32');
487 this.PlayerPhysplug = raptor_frame;
489 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
490 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);
492 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
493 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);
495 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
496 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);
499 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
500 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
501 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
503 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
504 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
505 if(vehic.vehicle_flags & VHF_HASSHIELD)
506 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
508 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
511 void raptor_blowup(entity this, entity toucher)
513 this.deadflag = DEAD_DEAD;
514 this.vehicle_exit(this, VHEF_NORMAL);
515 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL);
518 this.movetype = MOVETYPE_NONE;
519 this.effects = EF_NODRAW;
520 this.colormod = '0 0 0';
521 this.avelocity = '0 0 0';
522 this.velocity = '0 0 0';
524 setorigin(this, this.pos1);
525 settouch(this, func_null);
529 void raptor_diethink(entity this)
531 if(time >= this.wait)
533 raptor_blowup(this, NULL);
539 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
540 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
542 this.nextthink = time;
544 CSQCMODEL_AUTOUPDATE(this);
547 // If we dont do this ever now and then, the raptors rotors
548 // stop working, presumably due to angle overflow. cute.
549 void raptor_rotor_anglefix(entity this)
551 this.gun1.angles_y = anglemods(this.gun1.angles_y);
552 this.gun2.angles_y = anglemods(this.gun2.angles_y);
553 this.nextthink = time + 15;
556 bool raptor_impulse(entity this, int _imp)
560 case IMP_weapon_group_1.impulse:
561 this.vehicle.vehicle_weapon2mode = RSM_BOMB;
562 CSQCVehicleSetup(this, 0);
564 case IMP_weapon_group_2.impulse:
565 this.vehicle.vehicle_weapon2mode = RSM_FLARE;
566 CSQCVehicleSetup(this, 0);
569 case IMP_weapon_next_byid.impulse:
570 case IMP_weapon_next_bypriority.impulse:
571 case IMP_weapon_next_bygroup.impulse:
572 this.vehicle.vehicle_weapon2mode += 1;
573 if(this.vehicle.vehicle_weapon2mode > RSM_LAST)
574 this.vehicle.vehicle_weapon2mode = RSM_FIRST;
576 CSQCVehicleSetup(this, 0);
578 case IMP_weapon_last.impulse:
579 case IMP_weapon_prev_byid.impulse:
580 case IMP_weapon_prev_bypriority.impulse:
581 case IMP_weapon_prev_bygroup.impulse:
582 this.vehicle.vehicle_weapon2mode -= 1;
583 if(this.vehicle.vehicle_weapon2mode < RSM_FIRST)
584 this.vehicle.vehicle_weapon2mode = RSM_LAST;
586 CSQCVehicleSetup(this, 0);
590 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
592 case IMP_weapon_reload.impulse: // Manual minigun reload?
599 spawnfunc(vehicle_raptor)
601 if(!autocvar_g_vehicle_raptor) { remove(this); return; }
602 if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; }
605 METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
607 if(autocvar_g_vehicle_raptor_bouncepain)
608 vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
610 METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
612 instance.vehicle_weapon2mode = RSM_BOMB;
613 instance.owner.PlayerPhysplug = raptor_takeoff;
614 instance.movetype = MOVETYPE_BOUNCEMISSILE;
615 instance.solid = SOLID_SLIDEBOX;
616 instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
617 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
618 instance.velocity_z = 1; // Nudge upwards to takeoff sequense can work.
619 instance.tur_head.exteriormodeltoclient = instance.owner;
621 instance.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
624 if(instance.owner.flagcarried)
625 setorigin(instance.owner.flagcarried, '-20 0 96');
627 CSQCVehicleSetup(instance.owner, 0);
629 METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
632 instance.event_damage = func_null;
633 instance.solid = SOLID_CORPSE;
634 instance.takedamage = DAMAGE_NO;
635 instance.deadflag = DEAD_DYING;
636 instance.movetype = MOVETYPE_BOUNCE;
637 setthink(instance, raptor_diethink);
638 instance.nextthink = time;
639 instance.wait = time + 5 + (random() * 5);
641 Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
643 instance.velocity_z += 600;
645 instance.avelocity = '0 0.5 1' * (random() * 400);
646 instance.avelocity -= '0 0.5 1' * (random() * 400);
648 instance.colormod = '-0.5 -0.5 -0.5';
649 settouch(instance, raptor_blowup);
651 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
658 //FIXME: Camera is in a bad place in HUD model.
659 //setorigin(instance.vehicle_viewport, '25 0 5');
661 instance.vehicles_impulse = raptor_impulse;
665 instance.bomb1 = new(raptor_bomb);
666 instance.bomb2 = new(raptor_bomb);
667 instance.gun1 = new(raptor_gun);
668 instance.gun2 = new(raptor_gun);
670 setmodel(instance.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
671 setmodel(instance.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
672 setmodel(instance.gun1, MDL_VEH_RAPTOR_GUN);
673 setmodel(instance.gun2, MDL_VEH_RAPTOR_GUN);
674 setmodel(instance.tur_head, MDL_VEH_RAPTOR_TAIL);
676 setattachment(instance.bomb1, instance, "bombmount_left");
677 setattachment(instance.bomb2, instance, "bombmount_right");
678 setattachment(instance.tur_head, instance,"root");
680 // FIXMODEL Guns mounts to angled bones
681 instance.bomb1.angles = instance.angles;
682 instance.angles = '0 0 0';
683 // This messes up gun-aim, so work arround it.
684 //setattachment(instance.gun1, instance, "gunmount_left");
685 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_left"));
686 ofs -= instance.origin;
687 setattachment(instance.gun1, instance, "");
688 setorigin(instance.gun1, ofs);
690 //setattachment(instance.gun2, instance, "gunmount_right");
691 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_right"));
692 ofs -= instance.origin;
693 setattachment(instance.gun2, instance, "");
694 setorigin(instance.gun2, ofs);
696 instance.angles = instance.bomb1.angles;
697 instance.bomb1.angles = '0 0 0';
699 spinner = new(raptor_spinner);
700 spinner.owner = instance;
701 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
702 setattachment(spinner, instance, "engine_left");
703 spinner.movetype = MOVETYPE_NOCLIP;
704 spinner.avelocity = '0 90 0';
705 instance.bomb1.gun1 = spinner;
707 spinner = new(raptor_spinner);
708 spinner.owner = instance;
709 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
710 setattachment(spinner, instance, "engine_right");
711 spinner.movetype = MOVETYPE_NOCLIP;
712 spinner.avelocity = '0 -90 0';
713 instance.bomb1.gun2 = spinner;
716 setthink(instance.bomb1, raptor_rotor_anglefix);
717 instance.bomb1.nextthink = time;
723 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
724 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
725 instance.movetype = MOVETYPE_TOSS;
726 instance.solid = SOLID_SLIDEBOX;
727 instance.vehicle_energy = 1;
729 instance.PlayerPhysplug = raptor_frame;
731 instance.bomb1.gun1.avelocity_y = 90;
732 instance.bomb1.gun2.avelocity_y = -90;
734 instance.delay = time;
736 instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
737 instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
738 instance.damageforcescale = 0.25;
739 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
740 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
742 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
744 if(autocvar_g_vehicle_raptor_shield)
745 instance.vehicle_flags |= VHF_HASSHIELD;
747 if(autocvar_g_vehicle_raptor_shield_regen)
748 instance.vehicle_flags |= VHF_SHIELDREGEN;
750 if(autocvar_g_vehicle_raptor_health_regen)
751 instance.vehicle_flags |= VHF_HEALTHREGEN;
753 if(autocvar_g_vehicle_raptor_energy_regen)
754 instance.vehicle_flags |= VHF_ENERGYREGEN;
756 instance.vehicle_exit = raptor_exit;
757 instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
758 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
759 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
760 instance.max_health = instance.vehicle_health;
766 METHOD(Raptor, vr_hud, void(Raptor thisveh))
768 Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
769 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
770 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
772 METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player))
778 case RSM_FLARE: crosshair = vCROSS_RAIN; break;
779 case RSM_BOMB: crosshair = vCROSS_BURST; break;
780 default: crosshair = vCROSS_BURST;
783 vector tmpSize = '0 0 0';
784 if(weapon2mode != RSM_FLARE)
791 dropmark.owner = player;
792 dropmark.gravity = 1;
795 float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
798 setorigin(dropmark, pmove_org);
799 dropmark.velocity = pmove_vel;
800 tracetoss(dropmark, player);
802 where = project_3d_to_2d(trace_endpos);
804 setorigin(dropmark, trace_endpos);
805 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
807 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
809 where.x -= tmpSize.x * 0.5;
810 where.y -= tmpSize.y * 0.5;
812 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
813 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
815 dropmark.cnt = time + 5;
819 if(dropmark.cnt > time)
821 where = project_3d_to_2d(dropmark.origin);
822 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
824 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
826 where.x -= tmpSize.x * 0.5;
827 where.y -= tmpSize.y * 0.5;
829 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
830 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
836 Vehicles_drawCrosshair(crosshair);
838 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
840 AuxiliaryXhair[1].axh_image = vCROSS_LOCK;