X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fvehicles%2Fvehicle%2Fraptor.qc;h=a03c936bd787f6d8e075857ed38b3efc8c5841f3;hp=fe381d3c631b70fb8353b1d02372b38f6ce03315;hb=f34fd47ee0a7f283ab60592a17399ec5a500416c;hpb=281f8a0e6e5e8f49bda72eeeb864da2c0fa727f2 diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index fe381d3c6..a03c936bd 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -1,30 +1,5 @@ -#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 @@ -47,6 +22,8 @@ float autocvar_g_vehicle_raptor_speed_up = 1700; 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; @@ -82,7 +59,7 @@ void raptor_land(entity this) float hgt; hgt = vehicle_altitude(this, 512); - this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime); + this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME); this.angles_x *= 0.95; this.angles_z *= 0.95; @@ -94,7 +71,7 @@ void raptor_land(entity this) if(hgt < 16) { - this.movetype = MOVETYPE_TOSS; + set_movetype(this, MOVETYPE_TOSS); setthink(this, vehicles_think); this.frame = 0; } @@ -151,7 +128,7 @@ void raptor_exit(entity this, int eject) this.owner = NULL; } -bool raptor_frame(entity this) +bool raptor_frame(entity this, float dt) { entity vehic = this.vehicle; return = true; @@ -178,7 +155,7 @@ bool raptor_frame(entity this) 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) @@ -271,7 +248,7 @@ bool raptor_frame(entity this) 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'); @@ -285,7 +262,7 @@ bool raptor_frame(entity this) 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)) { @@ -311,7 +288,7 @@ bool raptor_frame(entity this) 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) @@ -329,8 +306,8 @@ bool raptor_frame(entity this) 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) @@ -387,13 +364,13 @@ bool raptor_frame(entity this) } 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)) @@ -428,9 +405,8 @@ bool raptor_frame(entity 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)) { @@ -457,7 +433,7 @@ bool raptor_frame(entity this) 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; @@ -475,7 +451,7 @@ bool raptor_takeoff(entity this) // 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; @@ -487,13 +463,13 @@ bool raptor_takeoff(entity this) 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); @@ -508,14 +484,14 @@ bool raptor_takeoff(entity this) 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'; @@ -529,7 +505,10 @@ void raptor_blowup(entity this) void raptor_diethink(entity this) { if(time >= this.wait) - setthink(this, raptor_blowup); + { + raptor_blowup(this, NULL); + return; + } if(random() < 0.05) { @@ -595,8 +574,8 @@ bool raptor_impulse(entity this, int _imp) 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)) @@ -608,11 +587,11 @@ METHOD(Raptor, vr_enter, 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; @@ -630,7 +609,7 @@ METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance)) 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); @@ -697,7 +676,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) 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; @@ -705,7 +684,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) 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; @@ -719,10 +698,13 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) 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; @@ -755,6 +737,9 @@ METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance)) 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 @@ -778,7 +763,7 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player)) } vector tmpSize = '0 0 0'; - if(weapon2mode != RSM_FLARE) + if(weapon2mode != RSM_FLARE && !spectatee_status) { vector where;