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 bool autocvar_g_vehicle_raptor_swim = false;
52 float autocvar_g_vehicle_raptor_cannon_turnspeed = 120;
53 float autocvar_g_vehicle_raptor_cannon_turnlimit = 20;
54 float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12;
55 float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32;
57 float autocvar_g_vehicle_raptor_cannon_locktarget = 0;
58 float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2;
59 float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45;
60 float autocvar_g_vehicle_raptor_cannon_locked_time = 1;
61 float autocvar_g_vehicle_raptor_cannon_predicttarget = 1;
63 float autocvar_g_vehicle_raptor_energy = 100;
64 float autocvar_g_vehicle_raptor_energy_regen = 25;
65 float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25;
67 float autocvar_g_vehicle_raptor_health = 150;
68 float autocvar_g_vehicle_raptor_health_regen = 0;
69 float autocvar_g_vehicle_raptor_health_regen_pause = 0;
71 float autocvar_g_vehicle_raptor_shield = 75;
72 float autocvar_g_vehicle_raptor_shield_regen = 25;
73 float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5;
75 float autocvar_g_vehicle_raptor_bouncefactor = 0.2;
76 float autocvar_g_vehicle_raptor_bouncestop = 0;
77 vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000';
82 void raptor_land(entity this)
86 hgt = vehicle_altitude(this, 512);
87 this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME);
88 this.angles_x *= 0.95;
89 this.angles_z *= 0.95;
91 if(hgt < 128 && hgt > 0)
92 this.frame = (hgt / 128) * 25;
94 this.bomb1.gun1.avelocity_y = 90 + ((this.frame / 25) * 2000);
95 this.bomb1.gun2.avelocity_y = -this.bomb1.gun1.avelocity_y;
99 set_movetype(this, MOVETYPE_TOSS);
100 setthink(this, vehicles_think);
104 this.nextthink = time;
106 CSQCMODEL_AUTOUPDATE(this);
109 void raptor_exit(entity this, int eject)
111 this.tur_head.exteriormodeltoclient = NULL;
115 setthink(this, raptor_land);
116 this.nextthink = time;
122 makevectors(this.angles);
126 spot = this.origin + v_forward * 100 + '0 0 64';
127 spot = vehicles_findgoodexit(this, spot);
128 setorigin(this.owner , spot);
129 this.owner.velocity = (v_up + v_forward * 0.25) * 750;
130 this.owner.oldvelocity = this.owner.velocity;
134 if(vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed))
136 this.owner.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2;
137 this.owner.velocity_z += 200;
138 spot = this.origin + v_forward * 32 + '0 0 64';
139 spot = vehicles_findgoodexit(this, spot);
143 this.owner.velocity = this.velocity * 0.5;
144 this.owner.velocity_z += 10;
145 spot = this.origin - v_forward * 200 + '0 0 64';
146 spot = vehicles_findgoodexit(this, spot);
148 this.owner.oldvelocity = this.owner.velocity;
149 setorigin(this.owner , spot);
152 antilag_clear(this.owner, CS(this.owner));
156 bool raptor_frame(entity this, float dt)
158 entity vehic = this.vehicle;
161 if(intermission_running)
163 vehic.velocity = '0 0 0';
164 vehic.avelocity = '0 0 0';
168 vehicles_frame(vehic, this);
171 ftmp = vlen(vehic.velocity);
172 if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
175 ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
178 if(vehic.sound_nexttime < time)
180 vehic.sound_nexttime = time + 7.955812;
181 //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
182 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
186 else if(fabs(ftmp - vehic.wait) > 0.2)
188 sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
189 sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
196 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
199 crosshair_trace(this);
201 //if(time - vehic.lastteleporttime < 1)
203 if(vehic.angles_z > 50 || vehic.angles_z < -50)
205 if(PHYS_INPUT_BUTTON_JUMP(this))
207 PHYS_INPUT_BUTTON_CROUCH(this) = true;
208 PHYS_INPUT_BUTTON_JUMP(this) = false;
215 vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
218 if(df_x > 180) df_x -= 360;
219 if(df_x < -180) df_x += 360;
220 if(df_y > 180) df_y -= 360;
221 if(df_y < -180) df_y += 360;
223 float ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
224 if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
225 vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
229 if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
230 else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
232 df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
233 ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
234 vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
236 vehic.angles_x = anglemods(vehic.angles_x);
237 vehic.angles_y = anglemods(vehic.angles_y);
238 vehic.angles_z = anglemods(vehic.angles_z);
240 if(autocvar_g_vehicle_raptor_movestyle == 1)
241 makevectors('0 1 0' * vehic.angles_y);
243 makevectors(this.v_angle);
245 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
247 if(this.movement_x != 0)
249 if(this.movement_x > 0)
250 df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
251 else if(this.movement_x < 0)
252 df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
255 if(this.movement_y != 0)
257 if(this.movement_y < 0)
258 df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
259 else if(this.movement_y > 0)
260 df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
262 vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
266 vehic.angles_z *= 0.95;
267 if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
271 if(PHYS_INPUT_BUTTON_CROUCH(this))
272 df -= v_up * autocvar_g_vehicle_raptor_speed_down;
273 else if (PHYS_INPUT_BUTTON_JUMP(this))
274 df += v_up * autocvar_g_vehicle_raptor_speed_up;
276 vehic.velocity += df * dt;
277 this.velocity = this.movement = vehic.velocity;
278 setorigin(this, vehic.origin + '0 0 32');
280 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
283 // Target lock & predict
284 if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
286 if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
287 vehic.gun1.enemy = NULL;
290 if(trace_ent.move_movetype)
291 if(trace_ent.takedamage)
292 if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
296 if(trace_ent.team != this.team)
298 vehic.gun1.enemy = trace_ent;
299 vehic.gun1.lock_time = time + 5;
304 vehic.gun1.enemy = trace_ent;
305 vehic.gun1.lock_time = time + 0.5;
311 float distance, impact_time;
313 vf = real_origin(vehic.gun1.enemy);
314 UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
315 vector _vel = vehic.gun1.enemy.velocity;
316 if(vehic.gun1.enemy.move_movetype == MOVETYPE_WALK)
319 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
322 distance = vlen(ad - this.origin);
323 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
324 ad = vf + _vel * impact_time;
331 else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
334 vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * dt,
335 (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * dt,
336 autocvar_g_vehicle_raptor_cannon_locked_time);
338 if(vehic.lock_target != NULL)
339 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
340 if(vehic.lock_strength == 1)
342 float i, distance, impact_time;
344 vf = real_origin(vehic.lock_target);
346 for(i = 0; i < 4; ++i)
348 distance = vlen(ad - vehic.origin);
349 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
350 ad = vf + vehic.lock_target.velocity * impact_time;
355 if(vehic.lock_target)
357 if(vehic.lock_strength == 1)
358 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
359 else if(vehic.lock_strength > 0.5)
360 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
361 else if(vehic.lock_strength < 0.5)
362 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
367 vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
368 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
369 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
371 vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
372 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
373 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
377 v_forward = vf * 0.5;
378 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
379 UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
382 Weapon wep1 = WEP_RAPTOR;
383 if(!forbidWeaponUse(this))
384 if(PHYS_INPUT_BUTTON_ATCK(this))
385 if (wep1.wr_checkammo1(wep1, vehic))
387 .entity weaponentity = weaponentities[0];
388 wep1.wr_think(wep1, vehic, weaponentity, 1);
391 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
392 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);
394 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
395 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);
397 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
398 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);
400 Weapon wep2a = WEP_RAPTOR_BOMB;
401 if(!forbidWeaponUse(this))
402 if(vehic.vehicle_weapon2mode == RSM_BOMB)
404 if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
405 if(PHYS_INPUT_BUTTON_ATCK2(this))
407 .entity weaponentity = weaponentities[1];
408 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
409 vehic.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
415 Weapon wep2b = WEP_RAPTOR_FLARE;
416 if(time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
417 if(PHYS_INPUT_BUTTON_ATCK2(this))
419 .entity weaponentity = weaponentities[1];
420 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
421 vehic.delay = time + autocvar_g_vehicle_raptor_flare_refire;
426 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
427 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
428 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
430 if(vehic.bomb1.cnt < time)
432 bool incoming = false;
433 IL_EACH(g_projectiles, it.enemy == vehic,
435 if(MISSILE_IS_TRACKING(it))
436 if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
446 soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
449 vehic.bomb1.cnt = time + 1;
453 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
454 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
455 if(vehic.vehicle_flags & VHF_HASSHIELD)
456 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
458 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
461 bool raptor_takeoff(entity this, float dt)
463 entity vehic = this.vehicle;
466 vehic.nextthink = time;
467 CSQCMODEL_AUTOUPDATE(vehic);
468 vehic.nextthink = 0; // will this work?
470 if(vehic.sound_nexttime < time)
472 vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
473 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
479 vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / PHYS_INPUT_FRAMETIME);
480 vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
481 vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
482 vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
483 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
485 setorigin(this, vehic.origin + '0 0 32');
488 this.PlayerPhysplug = raptor_frame;
490 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
491 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);
493 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
494 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);
496 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
497 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);
500 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
501 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
502 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
504 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
505 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
506 if(vehic.vehicle_flags & VHF_HASSHIELD)
507 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
509 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
512 void raptor_blowup(entity this, entity toucher)
514 this.deadflag = DEAD_DEAD;
515 this.vehicle_exit(this, VHEF_NORMAL);
516 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL);
519 set_movetype(this, MOVETYPE_NONE);
520 this.effects = EF_NODRAW;
521 this.colormod = '0 0 0';
522 this.avelocity = '0 0 0';
523 this.velocity = '0 0 0';
525 setorigin(this, this.pos1);
526 settouch(this, func_null);
530 void raptor_diethink(entity this)
532 if(time >= this.wait)
534 raptor_blowup(this, NULL);
540 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
541 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
543 this.nextthink = time;
545 CSQCMODEL_AUTOUPDATE(this);
548 // If we dont do this ever now and then, the raptors rotors
549 // stop working, presumably due to angle overflow. cute.
550 void raptor_rotor_anglefix(entity this)
552 this.gun1.angles_y = anglemods(this.gun1.angles_y);
553 this.gun2.angles_y = anglemods(this.gun2.angles_y);
554 this.nextthink = time + 15;
557 bool raptor_impulse(entity this, int _imp)
561 case IMP_weapon_group_1.impulse:
562 this.vehicle.vehicle_weapon2mode = RSM_BOMB;
563 CSQCVehicleSetup(this, 0);
565 case IMP_weapon_group_2.impulse:
566 this.vehicle.vehicle_weapon2mode = RSM_FLARE;
567 CSQCVehicleSetup(this, 0);
570 case IMP_weapon_next_byid.impulse:
571 case IMP_weapon_next_bypriority.impulse:
572 case IMP_weapon_next_bygroup.impulse:
573 this.vehicle.vehicle_weapon2mode += 1;
574 if(this.vehicle.vehicle_weapon2mode > RSM_LAST)
575 this.vehicle.vehicle_weapon2mode = RSM_FIRST;
577 CSQCVehicleSetup(this, 0);
579 case IMP_weapon_last.impulse:
580 case IMP_weapon_prev_byid.impulse:
581 case IMP_weapon_prev_bypriority.impulse:
582 case IMP_weapon_prev_bygroup.impulse:
583 this.vehicle.vehicle_weapon2mode -= 1;
584 if(this.vehicle.vehicle_weapon2mode < RSM_FIRST)
585 this.vehicle.vehicle_weapon2mode = RSM_LAST;
587 CSQCVehicleSetup(this, 0);
591 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
593 case IMP_weapon_reload.impulse: // Manual minigun reload?
600 spawnfunc(vehicle_raptor)
602 if(!autocvar_g_vehicle_raptor) { delete(this); return; }
603 if(!vehicle_initialize(this, VEH_RAPTOR, false)) { delete(this); return; }
606 METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
608 if(autocvar_g_vehicle_raptor_bouncepain)
609 vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
611 METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
613 instance.vehicle_weapon2mode = RSM_BOMB;
614 instance.owner.PlayerPhysplug = raptor_takeoff;
615 set_movetype(instance, MOVETYPE_BOUNCEMISSILE);
616 instance.solid = SOLID_SLIDEBOX;
617 instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
618 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
619 instance.velocity = '0 0 1'; // nudge upwards so takeoff sequence can work
620 instance.tur_head.exteriormodeltoclient = instance.owner;
622 instance.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
625 if(instance.owner.flagcarried)
626 setorigin(instance.owner.flagcarried, '-20 0 96');
628 CSQCVehicleSetup(instance.owner, 0);
630 METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
633 instance.event_damage = func_null;
634 instance.solid = SOLID_CORPSE;
635 instance.takedamage = DAMAGE_NO;
636 instance.deadflag = DEAD_DYING;
637 set_movetype(instance, MOVETYPE_BOUNCE);
638 setthink(instance, raptor_diethink);
639 instance.nextthink = time;
640 instance.wait = time + 5 + (random() * 5);
642 Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
644 instance.velocity_z += 600;
646 instance.avelocity = '0 0.5 1' * (random() * 400);
647 instance.avelocity -= '0 0.5 1' * (random() * 400);
649 instance.colormod = '-0.5 -0.5 -0.5';
650 settouch(instance, raptor_blowup);
652 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
659 //FIXME: Camera is in a bad place in HUD model.
660 //setorigin(instance.vehicle_viewport, '25 0 5');
662 instance.vehicles_impulse = raptor_impulse;
666 instance.bomb1 = new(raptor_bomb);
667 instance.bomb2 = new(raptor_bomb);
668 instance.gun1 = new(raptor_gun);
669 instance.gun2 = new(raptor_gun);
671 setmodel(instance.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
672 setmodel(instance.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
673 setmodel(instance.gun1, MDL_VEH_RAPTOR_GUN);
674 setmodel(instance.gun2, MDL_VEH_RAPTOR_GUN);
675 setmodel(instance.tur_head, MDL_VEH_RAPTOR_TAIL);
677 setattachment(instance.bomb1, instance, "bombmount_left");
678 setattachment(instance.bomb2, instance, "bombmount_right");
679 setattachment(instance.tur_head, instance,"root");
681 // FIXMODEL Guns mounts to angled bones
682 instance.bomb1.angles = instance.angles;
683 instance.angles = '0 0 0';
684 // This messes up gun-aim, so work arround it.
685 //setattachment(instance.gun1, instance, "gunmount_left");
686 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_left"));
687 ofs -= instance.origin;
688 setattachment(instance.gun1, instance, "");
689 setorigin(instance.gun1, ofs);
691 //setattachment(instance.gun2, instance, "gunmount_right");
692 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_right"));
693 ofs -= instance.origin;
694 setattachment(instance.gun2, instance, "");
695 setorigin(instance.gun2, ofs);
697 instance.angles = instance.bomb1.angles;
698 instance.bomb1.angles = '0 0 0';
700 spinner = new(raptor_spinner);
701 spinner.owner = instance;
702 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
703 setattachment(spinner, instance, "engine_left");
704 set_movetype(spinner, MOVETYPE_NOCLIP);
705 spinner.avelocity = '0 90 0';
706 instance.bomb1.gun1 = spinner;
708 spinner = new(raptor_spinner);
709 spinner.owner = instance;
710 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
711 setattachment(spinner, instance, "engine_right");
712 set_movetype(spinner, MOVETYPE_NOCLIP);
713 spinner.avelocity = '0 -90 0';
714 instance.bomb1.gun2 = spinner;
717 setthink(instance.bomb1, raptor_rotor_anglefix);
718 instance.bomb1.nextthink = time;
724 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
725 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
726 set_movetype(instance, MOVETYPE_TOSS);
727 instance.solid = SOLID_SLIDEBOX;
728 instance.vehicle_energy = 1;
730 if(!autocvar_g_vehicle_raptor_swim)
731 instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
733 instance.PlayerPhysplug = raptor_frame;
735 instance.bomb1.gun1.avelocity_y = 90;
736 instance.bomb1.gun2.avelocity_y = -90;
738 instance.delay = time;
740 instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
741 instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
742 instance.damageforcescale = 0.25;
743 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
744 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
746 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
748 if(autocvar_g_vehicle_raptor_shield)
749 instance.vehicle_flags |= VHF_HASSHIELD;
751 if(autocvar_g_vehicle_raptor_shield_regen)
752 instance.vehicle_flags |= VHF_SHIELDREGEN;
754 if(autocvar_g_vehicle_raptor_health_regen)
755 instance.vehicle_flags |= VHF_HEALTHREGEN;
757 if(autocvar_g_vehicle_raptor_energy_regen)
758 instance.vehicle_flags |= VHF_ENERGYREGEN;
760 instance.vehicle_exit = raptor_exit;
761 instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
762 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
763 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
764 instance.max_health = instance.vehicle_health;
766 if(!autocvar_g_vehicle_raptor_swim)
767 instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
773 METHOD(Raptor, vr_hud, void(Raptor thisveh))
775 Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
776 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
777 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
779 METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player))
785 case RSM_FLARE: crosshair = vCROSS_RAIN; break;
786 case RSM_BOMB: crosshair = vCROSS_BURST; break;
787 default: crosshair = vCROSS_BURST;
790 vector tmpSize = '0 0 0';
791 if(weapon2mode != RSM_FLARE && !spectatee_status)
798 dropmark.owner = player;
799 dropmark.gravity = 1;
802 float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
805 setorigin(dropmark, pmove_org);
806 dropmark.velocity = pmove_vel;
807 tracetoss(dropmark, player);
809 where = project_3d_to_2d(trace_endpos);
811 setorigin(dropmark, trace_endpos);
812 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
814 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
816 where.x -= tmpSize.x * 0.5;
817 where.y -= tmpSize.y * 0.5;
819 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
820 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
822 dropmark.cnt = time + 5;
826 if(dropmark.cnt > time)
828 where = project_3d_to_2d(dropmark.origin);
829 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
831 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
833 where.x -= tmpSize.x * 0.5;
834 where.y -= tmpSize.y * 0.5;
836 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
837 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
843 Vehicles_drawCrosshair(crosshair);
845 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
847 AuxiliaryXhair[1].axh_image = vCROSS_LOCK;