X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Fvehicles%2Fsv_vehicles.qc;h=bbecb83da6efe8b9cb65641dc66e6f38977e3cab;hb=2b18b279a8222a72ba713e6d3b72c2cba888407b;hp=590aba88a74e3db161e43de38b34bc3fbf1dfba0;hpb=76afe6b4bb64b3f349bcf8aeadd04d0b319a7d01;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 590aba88a..bbecb83da 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1,15 +1,16 @@ #include "sv_vehicles.qh" -#include -#include -#include -#include #include #include #include #include -#include +#include +#include +#include +#include +#include #include +#include bool SendAuxiliaryXhair(entity this, entity to, int sf) { @@ -172,43 +173,6 @@ void vehicles_locktarget(entity this, float incr, float decr, float _lock_time) } } -float vehicle_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); -} - -vector vehicles_force_fromtag_hover(entity this, string tag_name, float spring_length, float max_power) -{ - force_fromtag_origin = gettaginfo(this, gettagindex(this, tag_name)); - v_forward = normalize(v_forward) * -1; - traceline(force_fromtag_origin, force_fromtag_origin - (v_forward * spring_length), MOVE_NORMAL, this); - - force_fromtag_power = (1 - trace_fraction) * max_power; - force_fromtag_normpower = force_fromtag_power / max_power; - - return v_forward * force_fromtag_power; -} - -vector vehicles_force_fromtag_maglev(entity this, string tag_name, float spring_length, float max_power) -{ - force_fromtag_origin = gettaginfo(this, gettagindex(this, tag_name)); - v_forward = normalize(v_forward) * -1; - traceline(force_fromtag_origin, force_fromtag_origin - (v_forward * spring_length), MOVE_NORMAL, this); - - // TODO - this may NOT be compatible with wall/celing movement, unhardcode 0.25 (engine count multiplier) - if(trace_fraction == 1.0) - { - force_fromtag_normpower = -0.25; - return '0 0 -200'; - } - - force_fromtag_power = ((1 - trace_fraction) - trace_fraction) * max_power; - force_fromtag_normpower = force_fromtag_power / max_power; - - return v_forward * force_fromtag_power; -} - // projectile handling void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { @@ -262,10 +226,8 @@ entity vehicles_projectile(entity this, entity _mzlfx, Sound _mzlsound, int _deahtype, float _projtype, float _health, bool _cull, bool _clianim, entity _owner) { - TC(Sound, _mzlsound); - entity proj; - - proj = spawn(); + TC(Sound, _mzlsound); + entity proj = new(vehicles_projectile); PROJECTILE_MAKETRIGGER(proj); setorigin(proj, _org); @@ -335,7 +297,7 @@ void vehicles_gib_think(entity this) entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot) { - entity _gib = spawn(); + entity _gib = new(vehicle_gib); _setmodel(_gib, _template.model); vector org = gettaginfo(this, gettagindex(this, _tag)); setorigin(_gib, org); @@ -380,8 +342,8 @@ bool vehicle_addplayerslot( entity _owner, _slot.vehicle_enter = _enterfunc; STAT(HUD, _slot) = _hud; _slot.vehicle_flags = VHF_PLAYERSLOT; - _slot.vehicle_viewport = spawn(); - _slot.vehicle_hudmodel = spawn(); + _slot.vehicle_viewport = new(vehicle_viewport); + _slot.vehicle_hudmodel = new(vehicle_hudmodel); _slot.vehicle_hudmodel.viewmodelforclient = _slot; _slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT); @@ -694,7 +656,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag { if (wasfreed(this.vehicle_shieldent) || this.vehicle_shieldent == NULL) { - this.vehicle_shieldent = spawn(); + this.vehicle_shieldent = new(vehicle_shieldent); this.vehicle_shieldent.effects = EF_LOWPRECISION; setmodel(this.vehicle_shieldent, MDL_VEH_SHIELD);