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.solid = SOLID_NOT;
139 vehic.takedamage = DAMAGE_NO;
140 set_movetype(vehic, MOVETYPE_NONE);
144 vehicles_frame(vehic, this);
147 ftmp = vlen(vehic.velocity);
148 if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
151 ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
154 if(vehic.sound_nexttime < time)
156 vehic.sound_nexttime = time + 7.955812;
157 //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
158 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
162 else if(fabs(ftmp - vehic.wait) > 0.2)
164 sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
165 sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
172 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
175 crosshair_trace(this);
177 //if(time - vehic.lastteleporttime < 1)
179 if(vehic.angles_z > 50 || vehic.angles_z < -50)
181 if(PHYS_INPUT_BUTTON_JUMP(this))
183 PHYS_INPUT_BUTTON_CROUCH(this) = true;
184 PHYS_INPUT_BUTTON_JUMP(this) = false;
191 vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
194 if(df_x > 180) df_x -= 360;
195 if(df_x < -180) df_x += 360;
196 if(df_y > 180) df_y -= 360;
197 if(df_y < -180) df_y += 360;
199 float ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
200 if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
201 vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
205 if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
206 else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
208 df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
209 ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
210 vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
212 vehic.angles_x = anglemods(vehic.angles_x);
213 vehic.angles_y = anglemods(vehic.angles_y);
214 vehic.angles_z = anglemods(vehic.angles_z);
216 if(autocvar_g_vehicle_raptor_movestyle == 1)
217 makevectors('0 1 0' * vehic.angles_y);
219 makevectors(this.v_angle);
221 df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
223 if(this.movement_x != 0)
225 if(this.movement_x > 0)
226 df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
227 else if(this.movement_x < 0)
228 df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
231 if(this.movement_y != 0)
233 if(this.movement_y < 0)
234 df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
235 else if(this.movement_y > 0)
236 df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
238 vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
242 vehic.angles_z *= 0.95;
243 if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
247 if(PHYS_INPUT_BUTTON_CROUCH(this))
248 df -= v_up * autocvar_g_vehicle_raptor_speed_down;
249 else if (PHYS_INPUT_BUTTON_JUMP(this))
250 df += v_up * autocvar_g_vehicle_raptor_speed_up;
252 vehic.velocity += df * dt;
253 this.velocity = this.movement = vehic.velocity;
254 setorigin(this, vehic.origin + '0 0 32');
256 this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
259 // Target lock & predict
260 if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
262 if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
263 vehic.gun1.enemy = NULL;
266 if(trace_ent.move_movetype)
267 if(trace_ent.takedamage)
268 if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
272 if(trace_ent.team != this.team)
274 vehic.gun1.enemy = trace_ent;
275 vehic.gun1.lock_time = time + 5;
280 vehic.gun1.enemy = trace_ent;
281 vehic.gun1.lock_time = time + 0.5;
287 float distance, impact_time;
289 vf = real_origin(vehic.gun1.enemy);
290 UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
291 vector _vel = vehic.gun1.enemy.velocity;
292 if(vehic.gun1.enemy.move_movetype == MOVETYPE_WALK)
295 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
298 distance = vlen(ad - this.origin);
299 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
300 ad = vf + _vel * impact_time;
307 else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
310 vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * dt,
311 (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * dt,
312 autocvar_g_vehicle_raptor_cannon_locked_time);
314 if(vehic.lock_target != NULL)
315 if(autocvar_g_vehicle_raptor_cannon_predicttarget)
316 if(vehic.lock_strength == 1)
318 float i, distance, impact_time;
320 vf = real_origin(vehic.lock_target);
322 for(i = 0; i < 4; ++i)
324 distance = vlen(ad - vehic.origin);
325 impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
326 ad = vf + vehic.lock_target.velocity * impact_time;
331 if(vehic.lock_target)
333 if(vehic.lock_strength == 1)
334 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
335 else if(vehic.lock_strength > 0.5)
336 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
337 else if(vehic.lock_strength < 0.5)
338 UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
343 vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
344 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
345 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
347 vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
348 autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
349 autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
353 v_forward = vf * 0.5;
354 traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
355 UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
358 Weapon wep1 = WEP_RAPTOR;
359 .entity weaponentity = weaponentities[0];
360 if(!forbidWeaponUse(this))
361 if(PHYS_INPUT_BUTTON_ATCK(this))
362 if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
364 wep1.wr_think(wep1, vehic, weaponentity, 1);
367 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
368 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);
370 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
371 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);
373 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
374 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);
376 Weapon wep2a = WEP_RAPTOR_BOMB;
377 if(!forbidWeaponUse(this))
378 if(vehic.vehicle_weapon2mode == RSM_BOMB)
380 if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
381 if(PHYS_INPUT_BUTTON_ATCK2(this))
383 .entity weaponentity = weaponentities[1];
384 wep2a.wr_think(wep2a, vehic, weaponentity, 2);
385 vehic.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
391 Weapon wep2b = WEP_RAPTOR_FLARE;
392 if(time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
393 if(PHYS_INPUT_BUTTON_ATCK2(this))
395 .entity weaponentity = weaponentities[1];
396 wep2b.wr_think(wep2b, vehic, weaponentity, 2);
397 vehic.delay = time + autocvar_g_vehicle_raptor_flare_refire;
402 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
403 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
404 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
406 if(vehic.bomb1.cnt < time)
408 bool incoming = false;
409 IL_EACH(g_projectiles, it.enemy == vehic,
411 if(MISSILE_IS_TRACKING(it))
412 if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
422 soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
425 vehic.bomb1.cnt = time + 1;
429 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
430 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
431 if(vehic.vehicle_flags & VHF_HASSHIELD)
432 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
434 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
437 bool raptor_takeoff(entity this, float dt)
439 entity vehic = this.vehicle;
442 vehic.nextthink = time;
443 CSQCMODEL_AUTOUPDATE(vehic);
444 vehic.nextthink = 0; // will this work?
446 if(vehic.sound_nexttime < time)
448 vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
449 sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
455 vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / PHYS_INPUT_FRAMETIME);
456 vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
457 vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
458 vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
459 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
461 setorigin(this, vehic.origin + '0 0 32');
464 this.PlayerPhysplug = raptor_frame;
466 if(vehic.vehicle_flags & VHF_SHIELDREGEN)
467 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);
469 if(vehic.vehicle_flags & VHF_HEALTHREGEN)
470 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);
472 if(vehic.vehicle_flags & VHF_ENERGYREGEN)
473 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);
476 vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
477 this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
478 this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
480 VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
481 VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
482 if(vehic.vehicle_flags & VHF_HASSHIELD)
483 VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
485 PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
488 void raptor_blowup(entity this, entity toucher)
490 this.deadflag = DEAD_DEAD;
491 this.vehicle_exit(this, VHEF_NORMAL);
492 RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL);
495 set_movetype(this, MOVETYPE_NONE);
496 this.effects = EF_NODRAW;
497 this.colormod = '0 0 0';
498 this.avelocity = '0 0 0';
499 this.velocity = '0 0 0';
501 setorigin(this, this.pos1);
502 settouch(this, func_null);
506 void raptor_diethink(entity this)
508 if(time >= this.wait)
510 raptor_blowup(this, NULL);
516 sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
517 Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
519 this.nextthink = time;
521 CSQCMODEL_AUTOUPDATE(this);
524 // If we dont do this ever now and then, the raptors rotors
525 // stop working, presumably due to angle overflow. cute.
526 void raptor_rotor_anglefix(entity this)
528 this.gun1.angles_y = anglemods(this.gun1.angles_y);
529 this.gun2.angles_y = anglemods(this.gun2.angles_y);
530 this.nextthink = time + 15;
533 bool raptor_impulse(entity this, int _imp)
537 case IMP_weapon_group_1.impulse:
538 this.vehicle.vehicle_weapon2mode = RSM_BOMB;
539 CSQCVehicleSetup(this, 0);
541 case IMP_weapon_group_2.impulse:
542 this.vehicle.vehicle_weapon2mode = RSM_FLARE;
543 CSQCVehicleSetup(this, 0);
546 case IMP_weapon_next_byid.impulse:
547 case IMP_weapon_next_bypriority.impulse:
548 case IMP_weapon_next_bygroup.impulse:
549 this.vehicle.vehicle_weapon2mode += 1;
550 if(this.vehicle.vehicle_weapon2mode > RSM_LAST)
551 this.vehicle.vehicle_weapon2mode = RSM_FIRST;
553 CSQCVehicleSetup(this, 0);
555 case IMP_weapon_last.impulse:
556 case IMP_weapon_prev_byid.impulse:
557 case IMP_weapon_prev_bypriority.impulse:
558 case IMP_weapon_prev_bygroup.impulse:
559 this.vehicle.vehicle_weapon2mode -= 1;
560 if(this.vehicle.vehicle_weapon2mode < RSM_FIRST)
561 this.vehicle.vehicle_weapon2mode = RSM_LAST;
563 CSQCVehicleSetup(this, 0);
567 case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
569 case IMP_weapon_reload.impulse: // Manual minigun reload?
576 spawnfunc(vehicle_raptor)
578 if(!autocvar_g_vehicle_raptor) { delete(this); return; }
579 if(!vehicle_initialize(this, VEH_RAPTOR, false)) { delete(this); return; }
582 METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
584 if(autocvar_g_vehicle_raptor_bouncepain)
585 vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
587 METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
589 instance.vehicle_weapon2mode = RSM_BOMB;
590 instance.owner.PlayerPhysplug = raptor_takeoff;
591 set_movetype(instance, MOVETYPE_BOUNCEMISSILE);
592 instance.solid = SOLID_SLIDEBOX;
593 instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
594 instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
595 instance.velocity = '0 0 1'; // nudge upwards so takeoff sequence can work
596 instance.tur_head.exteriormodeltoclient = instance.owner;
598 instance.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
601 if(instance.owner.flagcarried)
602 setorigin(instance.owner.flagcarried, '-20 0 96');
604 CSQCVehicleSetup(instance.owner, 0);
606 METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
609 instance.event_damage = func_null;
610 instance.solid = SOLID_CORPSE;
611 instance.takedamage = DAMAGE_NO;
612 instance.deadflag = DEAD_DYING;
613 set_movetype(instance, MOVETYPE_BOUNCE);
614 setthink(instance, raptor_diethink);
615 instance.nextthink = time;
616 instance.wait = time + 5 + (random() * 5);
618 Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1);
620 instance.velocity_z += 600;
622 instance.avelocity = '0 0.5 1' * (random() * 400);
623 instance.avelocity -= '0 0.5 1' * (random() * 400);
625 instance.colormod = '-0.5 -0.5 -0.5';
626 settouch(instance, raptor_blowup);
628 METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
635 //FIXME: Camera is in a bad place in HUD model.
636 //setorigin(instance.vehicle_viewport, '25 0 5');
638 instance.vehicles_impulse = raptor_impulse;
642 instance.bomb1 = new(raptor_bomb);
643 instance.bomb2 = new(raptor_bomb);
644 instance.gun1 = new(raptor_gun);
645 instance.gun2 = new(raptor_gun);
647 setmodel(instance.bomb1, MDL_VEH_RAPTOR_CB_FOLDED);
648 setmodel(instance.bomb2, MDL_VEH_RAPTOR_CB_FOLDED);
649 setmodel(instance.gun1, MDL_VEH_RAPTOR_GUN);
650 setmodel(instance.gun2, MDL_VEH_RAPTOR_GUN);
651 setmodel(instance.tur_head, MDL_VEH_RAPTOR_TAIL);
653 setattachment(instance.bomb1, instance, "bombmount_left");
654 setattachment(instance.bomb2, instance, "bombmount_right");
655 setattachment(instance.tur_head, instance,"root");
657 // FIXMODEL Guns mounts to angled bones
658 instance.bomb1.angles = instance.angles;
659 instance.angles = '0 0 0';
660 // This messes up gun-aim, so work arround it.
661 //setattachment(instance.gun1, instance, "gunmount_left");
662 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_left"));
663 ofs -= instance.origin;
664 setattachment(instance.gun1, instance, "");
665 setorigin(instance.gun1, ofs);
667 //setattachment(instance.gun2, instance, "gunmount_right");
668 ofs = gettaginfo(instance, gettagindex(instance, "gunmount_right"));
669 ofs -= instance.origin;
670 setattachment(instance.gun2, instance, "");
671 setorigin(instance.gun2, ofs);
673 instance.angles = instance.bomb1.angles;
674 instance.bomb1.angles = '0 0 0';
676 spinner = new(raptor_spinner);
677 spinner.owner = instance;
678 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
679 setattachment(spinner, instance, "engine_left");
680 set_movetype(spinner, MOVETYPE_NOCLIP);
681 spinner.avelocity = '0 90 0';
682 instance.bomb1.gun1 = spinner;
684 spinner = new(raptor_spinner);
685 spinner.owner = instance;
686 setmodel(spinner, MDL_VEH_RAPTOR_PROP);
687 setattachment(spinner, instance, "engine_right");
688 set_movetype(spinner, MOVETYPE_NOCLIP);
689 spinner.avelocity = '0 -90 0';
690 instance.bomb1.gun2 = spinner;
693 setthink(instance.bomb1, raptor_rotor_anglefix);
694 instance.bomb1.nextthink = time;
700 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
701 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
702 set_movetype(instance, MOVETYPE_TOSS);
703 instance.solid = SOLID_SLIDEBOX;
704 instance.vehicle_energy = 1;
706 if(!autocvar_g_vehicle_raptor_swim)
707 instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
709 instance.PlayerPhysplug = raptor_frame;
711 instance.bomb1.gun1.avelocity_y = 90;
712 instance.bomb1.gun2.avelocity_y = -90;
714 instance.delay = time;
716 instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
717 instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
718 instance.damageforcescale = 0.25;
719 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
720 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
722 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
724 if(autocvar_g_vehicle_raptor_shield)
725 instance.vehicle_flags |= VHF_HASSHIELD;
727 if(autocvar_g_vehicle_raptor_shield_regen)
728 instance.vehicle_flags |= VHF_SHIELDREGEN;
730 if(autocvar_g_vehicle_raptor_health_regen)
731 instance.vehicle_flags |= VHF_HEALTHREGEN;
733 if(autocvar_g_vehicle_raptor_energy_regen)
734 instance.vehicle_flags |= VHF_ENERGYREGEN;
736 instance.vehicle_exit = raptor_exit;
737 instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
738 instance.vehicle_health = autocvar_g_vehicle_raptor_health;
739 instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
740 instance.max_health = instance.vehicle_health;
742 if(!autocvar_g_vehicle_raptor_swim)
743 instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
749 METHOD(Raptor, vr_hud, void(Raptor thisveh))
751 Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
752 "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
753 "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
755 METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player))
761 case RSM_FLARE: crosshair = vCROSS_RAIN; break;
762 case RSM_BOMB: crosshair = vCROSS_BURST; break;
763 default: crosshair = vCROSS_BURST;
766 vector tmpSize = '0 0 0';
767 if(weapon2mode != RSM_FLARE && !spectatee_status)
774 dropmark.owner = player;
775 dropmark.gravity = 1;
778 float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01;
781 setorigin(dropmark, pmove_org);
782 dropmark.velocity = pmove_vel;
783 tracetoss(dropmark, player);
785 where = project_3d_to_2d(trace_endpos);
787 setorigin(dropmark, trace_endpos);
788 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
790 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
792 where.x -= tmpSize.x * 0.5;
793 where.y -= tmpSize.y * 0.5;
795 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
796 drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
798 dropmark.cnt = time + 5;
802 if(dropmark.cnt > time)
804 where = project_3d_to_2d(dropmark.origin);
805 tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
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, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
813 drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
819 Vehicles_drawCrosshair(crosshair);
821 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
823 AuxiliaryXhair[1].axh_image = vCROSS_LOCK;