-#ifndef VEHICLE_RAPTOR
-#define VEHICLE_RAPTOR
#include "raptor.qh"
-#include "raptor_weapons.qh"
-
-CLASS(Raptor, Vehicle)
-/* spawnflags */ ATTRIB(Raptor, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
-/* mins */ ATTRIB(Raptor, mins, vector, '-80 -80 0');
-/* maxs */ ATTRIB(Raptor, maxs, vector, '80 80 70');
-/* view offset*/ ATTRIB(Raptor, view_ofs, vector, '0 0 160');
-/* view dist */ ATTRIB(Raptor, height, float, 200);
-/* model */ ATTRIB(Raptor, mdl, string, "models/vehicles/raptor.dpm");
-/* model */ ATTRIB(Raptor, model, string, "models/vehicles/raptor.dpm");
-/* head_model */ ATTRIB(Raptor, head_model, string, "");
-/* hud_model */ ATTRIB(Raptor, hud_model, string, "models/vehicles/raptor_cockpit.dpm");
-/* tags */ ATTRIB(Raptor, tag_head, string, "");
-/* tags */ ATTRIB(Raptor, tag_hud, string, "tag_hud");
-/* tags */ ATTRIB(Raptor, tag_view, string, "tag_camera");
-/* netname */ ATTRIB(Raptor, netname, string, "raptor");
-/* fullname */ ATTRIB(Raptor, vehicle_name, string, _("Raptor"));
-/* icon */ ATTRIB(Raptor, m_icon, string, "vehicle_raptor");
-ENDCLASS(Raptor)
-REGISTER_VEHICLE(RAPTOR, NEW(Raptor));
-
-#endif
-
#ifdef IMPLEMENTATION
#ifdef SVQC
float autocvar_g_vehicle_raptor_speed_down = 1700;
float autocvar_g_vehicle_raptor_friction = 2;
+bool autocvar_g_vehicle_raptor_swim = false;
+
float autocvar_g_vehicle_raptor_cannon_turnspeed = 120;
float autocvar_g_vehicle_raptor_cannon_turnlimit = 20;
float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12;
.entity bomb1;
.entity bomb2;
-float raptor_altitude(entity this, float amax)
-{
- tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * amax), MOVE_WORLDONLY, this);
- return vlen(this.origin - trace_endpos);
-}
-
void raptor_land(entity this)
{
float hgt;
- hgt = raptor_altitude(this, 512);
- this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
+ hgt = vehicle_altitude(this, 512);
+ this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME);
this.angles_x *= 0.95;
this.angles_z *= 0.95;
- if(hgt < 128)
- if(hgt > 0)
+ if(hgt < 128 && hgt > 0)
this.frame = (hgt / 128) * 25;
this.bomb1.gun1.avelocity_y = 90 + ((this.frame / 25) * 2000);
if(hgt < 16)
{
- this.movetype = MOVETYPE_TOSS;
+ set_movetype(this, MOVETYPE_TOSS);
setthink(this, vehicles_think);
this.frame = 0;
}
void raptor_exit(entity this, int eject)
{
- vector spot;
this.tur_head.exteriormodeltoclient = NULL;
if(!IS_DEAD(this))
{
setthink(this, raptor_land);
- this.nextthink = time;
+ this.nextthink = time;
}
if(!this.owner)
return;
makevectors(this.angles);
+ vector spot;
if(eject)
{
spot = this.origin + v_forward * 100 + '0 0 64';
this.owner = NULL;
}
-bool raptor_frame(entity this)
+bool raptor_frame(entity this, float dt)
{
entity vehic = this.vehicle;
return = true;
if(intermission_running)
{
- vehic.velocity = '0 0 0';
- vehic.avelocity = '0 0 0';
+ vehic.solid = SOLID_NOT;
+ vehic.takedamage = DAMAGE_NO;
+ set_movetype(vehic, MOVETYPE_NONE);
return;
}
vehicles_frame(vehic, this);
- float ftmp = 0;
/*
ftmp = vlen(vehic.velocity);
if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
vehic.sound_nexttime = time + 7.955812;
//sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
- vehic.wait = ftmp;
+ vehic.wait = 0;
}
/*
else if(fabs(ftmp - vehic.wait) > 0.2)
if(df_y > 180) df_y -= 360;
if(df_y < -180) df_y += 360;
- ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
+ float ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
else if (PHYS_INPUT_BUTTON_JUMP(this))
df += v_up * autocvar_g_vehicle_raptor_speed_up;
- vehic.velocity += df * frametime;
+ vehic.velocity += df * dt;
this.velocity = this.movement = vehic.velocity;
setorigin(this, vehic.origin + '0 0 32');
vehic.gun1.enemy = NULL;
if(trace_ent)
- if(trace_ent.movetype)
+ if(trace_ent.move_movetype)
if(trace_ent.takedamage)
if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
{
vf = real_origin(vehic.gun1.enemy);
UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
vector _vel = vehic.gun1.enemy.velocity;
- if(vehic.gun1.enemy.movetype == MOVETYPE_WALK)
+ if(vehic.gun1.enemy.move_movetype == MOVETYPE_WALK)
_vel_z *= 0.1;
if(autocvar_g_vehicle_raptor_cannon_predicttarget)
else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
{
- vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime,
- (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * frametime,
+ vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * dt,
+ (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * dt,
autocvar_g_vehicle_raptor_cannon_locked_time);
if(vehic.lock_target != NULL)
*/
Weapon wep1 = WEP_RAPTOR;
+ .entity weaponentity = weaponentities[0];
if(!forbidWeaponUse(this))
if(PHYS_INPUT_BUTTON_ATCK(this))
- if (wep1.wr_checkammo1(wep1, vehic))
+ if (wep1.wr_checkammo1(wep1, vehic, weaponentity))
{
- .entity weaponentity = weaponentities[0];
wep1.wr_think(wep1, vehic, weaponentity, 1);
}
if(vehic.vehicle_flags & VHF_SHIELDREGEN)
- 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);
+ 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);
if(vehic.vehicle_flags & VHF_HEALTHREGEN)
- 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);
+ 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);
if(vehic.vehicle_flags & VHF_ENERGYREGEN)
- 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);
+ 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);
Weapon wep2a = WEP_RAPTOR_BOMB;
if(!forbidWeaponUse(this))
if(vehic.bomb1.cnt < time)
{
bool incoming = false;
- FOREACH_ENTITY_ENT(enemy, vehic,
+ IL_EACH(g_projectiles, it.enemy == vehic,
{
- if(it.flags & FL_PROJECTILE)
if(MISSILE_IS_TRACKING(it))
if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
{
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
}
-bool raptor_takeoff(entity this)
+bool raptor_takeoff(entity this, float dt)
{
entity vehic = this.vehicle;
return = true;
// Takeoff sequense
if(vehic.frame < 25)
{
- vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime);
+ vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / PHYS_INPUT_FRAMETIME);
vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
this.PlayerPhysplug = raptor_frame;
if(vehic.vehicle_flags & VHF_SHIELDREGEN)
- 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);
+ 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);
if(vehic.vehicle_flags & VHF_HEALTHREGEN)
- 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);
+ 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);
if(vehic.vehicle_flags & VHF_ENERGYREGEN)
- 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);
+ 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);
vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
}
-void raptor_blowup(entity this)
+void raptor_blowup(entity this, entity toucher)
{
this.deadflag = DEAD_DEAD;
this.vehicle_exit(this, VHEF_NORMAL);
RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL);
this.alpha = -1;
- this.movetype = MOVETYPE_NONE;
+ set_movetype(this, MOVETYPE_NONE);
this.effects = EF_NODRAW;
this.colormod = '0 0 0';
this.avelocity = '0 0 0';
void raptor_diethink(entity this)
{
if(time >= this.wait)
- setthink(this, raptor_blowup);
+ {
+ raptor_blowup(this, NULL);
+ return;
+ }
if(random() < 0.05)
{
spawnfunc(vehicle_raptor)
{
- if(!autocvar_g_vehicle_raptor) { remove(this); return; }
- if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; }
+ if(!autocvar_g_vehicle_raptor) { delete(this); return; }
+ if(!vehicle_initialize(this, VEH_RAPTOR, false)) { delete(this); return; }
}
METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
{
instance.vehicle_weapon2mode = RSM_BOMB;
instance.owner.PlayerPhysplug = raptor_takeoff;
- instance.movetype = MOVETYPE_BOUNCEMISSILE;
+ set_movetype(instance, MOVETYPE_BOUNCEMISSILE);
instance.solid = SOLID_SLIDEBOX;
instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100;
instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
- instance.velocity_z = 1; // Nudge upwards to takeoff sequense can work.
+ instance.velocity = '0 0 1'; // nudge upwards so takeoff sequence can work
instance.tur_head.exteriormodeltoclient = instance.owner;
instance.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
instance.solid = SOLID_CORPSE;
instance.takedamage = DAMAGE_NO;
instance.deadflag = DEAD_DYING;
- instance.movetype = MOVETYPE_BOUNCE;
+ set_movetype(instance, MOVETYPE_BOUNCE);
setthink(instance, raptor_diethink);
instance.nextthink = time;
instance.wait = time + 5 + (random() * 5);
spinner.owner = instance;
setmodel(spinner, MDL_VEH_RAPTOR_PROP);
setattachment(spinner, instance, "engine_left");
- spinner.movetype = MOVETYPE_NOCLIP;
+ set_movetype(spinner, MOVETYPE_NOCLIP);
spinner.avelocity = '0 90 0';
instance.bomb1.gun1 = spinner;
spinner.owner = instance;
setmodel(spinner, MDL_VEH_RAPTOR_PROP);
setattachment(spinner, instance, "engine_right");
- spinner.movetype = MOVETYPE_NOCLIP;
+ set_movetype(spinner, MOVETYPE_NOCLIP);
spinner.avelocity = '0 -90 0';
instance.bomb1.gun2 = spinner;
instance.frame = 0;
instance.vehicle_health = autocvar_g_vehicle_raptor_health;
instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
- instance.movetype = MOVETYPE_TOSS;
+ set_movetype(instance, MOVETYPE_TOSS);
instance.solid = SOLID_SLIDEBOX;
instance.vehicle_energy = 1;
+ if(!autocvar_g_vehicle_raptor_swim)
+ instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
+
instance.PlayerPhysplug = raptor_frame;
instance.bomb1.gun1.avelocity_y = 90;
instance.vehicle_health = autocvar_g_vehicle_raptor_health;
instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
instance.max_health = instance.vehicle_health;
+
+ if(!autocvar_g_vehicle_raptor_swim)
+ instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
}
#endif
}
vector tmpSize = '0 0 0';
- if(weapon2mode != RSM_FLARE)
+ if(weapon2mode != RSM_FLARE && !spectatee_status)
{
vector where;