#include "racer.qh"
+#ifdef GAMEQC
+
#ifdef SVQC
#include <common/mapobjects/trigger/impulse.qh>
.float racer_watertime;
-var vector racer_force_from_tag(entity this, string tag_name, float spring_length, float max_power);
+var .vector(entity this, string tag_name, float spring_length, float max_power) racer_force_from_tag;
-void racer_align4point(entity this, float _delta)
+void racer_align4point(entity this, entity player, float _delta)
{
vector push_vector;
float fl_push, fr_push, bl_push, br_push;
- push_vector = racer_force_from_tag(this, "tag_engine_fr", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
+ push_vector = this.racer_force_from_tag(this, "tag_engine_fr", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
fr_push = force_fromtag_normpower;
//vehicles_sweap_collision(force_fromtag_origin, this.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
- push_vector += racer_force_from_tag(this, "tag_engine_fl", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
+ push_vector += this.racer_force_from_tag(this, "tag_engine_fl", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
fl_push = force_fromtag_normpower;
//vehicles_sweap_collision(force_fromtag_origin, this.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
- push_vector += racer_force_from_tag(this, "tag_engine_br", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
+ push_vector += this.racer_force_from_tag(this, "tag_engine_br", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
br_push = force_fromtag_normpower;
//vehicles_sweap_collision(force_fromtag_origin, this.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
- push_vector += racer_force_from_tag(this, "tag_engine_bl", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
+ push_vector += this.racer_force_from_tag(this, "tag_engine_bl", autocvar_g_vehicle_racer_springlength, autocvar_g_vehicle_racer_hoverpower);
bl_push = force_fromtag_normpower;
//vehicles_sweap_collision(force_fromtag_origin, this.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
{
uforce = autocvar_g_vehicle_racer_water_upforcedamper;
- if(PHYS_INPUT_BUTTON_CROUCH(this.owner) && time < this.air_finished)
+ if(PHYS_INPUT_BUTTON_CROUCH(player) && time < this.air_finished)
this.velocity_z += 30;
else
this.velocity_z += 200;
return;
}
- racer_align4point(vehic, dt);
+ racer_align4point(vehic, player, dt);
PHYS_INPUT_BUTTON_ZOOM(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
void racer_think(entity this)
{
- this.nextthink = time + autocvar_g_vehicle_racer_thinkrate;
+ float dt = autocvar_g_vehicle_racer_thinkrate;
+
+ this.nextthink = time + dt;
tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * autocvar_g_vehicle_racer_springlength), MOVE_NOMONSTERS, this);
this.velocity_z += 200;
}
- this.velocity += df * autocvar_g_vehicle_racer_thinkrate;
+ this.velocity += df * dt;
if(this.velocity_z > 0)
- this.velocity_z *= 1 - forced * autocvar_g_vehicle_racer_thinkrate;
+ this.velocity_z *= 1 - forced * dt;
- this.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * autocvar_g_vehicle_racer_thinkrate);
- this.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * autocvar_g_vehicle_racer_thinkrate);
+ this.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * dt);
+ this.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * dt);
CSQCMODEL_AUTOUPDATE(this);
}
if(time >= this.delay)
racer_blowup(this);
- CSQCMODEL_AUTOUPDATE(this);
+ //CSQCMODEL_AUTOUPDATE(this);
}
void racer_deadtouch(entity this, entity toucher)
METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
{
-#ifdef SVQC
set_movetype(instance, MOVETYPE_BOUNCE);
+#ifdef SVQC
instance.owner.vehicle_health = (GetResource(instance, RES_HEALTH) / autocvar_g_vehicle_racer_health) * 100;
instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_racer_shield) * 100;
if(instance.owner.flagcarried)
setorigin(instance.owner.flagcarried, '-190 0 96');
-#elif defined(CSQC)
- set_movetype(instance, MOVETYPE_BOUNCE);
#endif
}
METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
{
#ifdef SVQC
- if(instance.scale != 0.5)
- {
- if(autocvar_g_vehicle_racer_hovertype != 0)
- racer_force_from_tag = vehicles_force_fromtag_maglev;
- else
- racer_force_from_tag = vehicles_force_fromtag_hover;
-
- // FIXME: this be hakkz, fix the models insted (scale body, add tag_viewport to the hudmodel).
- instance.scale = 0.5;
- setattachment(instance.vehicle_hudmodel, instance, "");
- setattachment(instance.vehicle_viewport, instance, "tag_viewport");
-
- instance.mass = 900;
- }
+ if(autocvar_g_vehicle_racer_hovertype != 0)
+ instance.racer_force_from_tag = vehicles_force_fromtag_maglev;
+ else
+ instance.racer_force_from_tag = vehicles_force_fromtag_hover;
setthink(instance, racer_think);
instance.nextthink = time;
set_movetype(instance, MOVETYPE_TOSS);
instance.solid = SOLID_SLIDEBOX;
instance.delay = time;
- instance.scale = 0.5;
+ instance.scale = 0.5; // FIXME: this be hakkz, fix the models insted (scale body, add tag_viewport to the hudmodel).
+ instance.mass = 900;
+
+ setattachment(instance.vehicle_hudmodel, instance, "");
+ setattachment(instance.vehicle_viewport, instance, "tag_viewport");
instance.PlayerPhysplug = racer_frame;
instance.vehicle_exit = racer_exit;
// we have no need to network energy
- if(autocvar_g_vehicle_racer_energy)
- if(autocvar_g_vehicle_racer_energy_regen)
+ if(autocvar_g_vehicle_racer_energy && autocvar_g_vehicle_racer_energy_regen)
instance.vehicle_flags |= VHF_ENERGYREGEN;
if(autocvar_g_vehicle_racer_shield)
AuxiliaryXhair[0].axh_image = vCROSS_LOCK; // Rocket
#endif
}
+
+#endif