+#include "vehicles.qh"
+
+#include "../cl_player.qh"
+#include "../waypointsprites.qh"
+
+#include "../bot/waypoints.qh"
+
+.float() PlayerPhysplug;
+
float autocvar_g_vehicles_crush_dmg;
float autocvar_g_vehicles_crush_force;
float autocvar_g_vehicles_delayspawn;
float autocvar_g_vehicles_delayspawn_jitter;
-var float autocvar_g_vehicles_vortex_damagerate = 0.5;
-var float autocvar_g_vehicles_machinegun_damagerate = 0.5;
-var float autocvar_g_vehicles_rifle_damagerate = 0.75;
-var float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
-var float autocvar_g_vehicles_tag_damagerate = 5;
+float autocvar_g_vehicles_vortex_damagerate = 0.5;
+float autocvar_g_vehicles_machinegun_damagerate = 0.5;
+float autocvar_g_vehicles_rifle_damagerate = 0.75;
+float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
+float autocvar_g_vehicles_tag_damagerate = 5;
float autocvar_g_vehicles;
-void vehicles_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
+void vehicles_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
void vehicles_return();
void vehicles_enter();
void vehicles_touch();
const float MAX_AXH = 4;
.entity AuxiliaryXhair[MAX_AXH];
-float SendAuxiliaryXhair(entity to, float sf)
+float SendAuxiliaryXhair(entity to, int sf)
{
WriteByte(MSG_ENTITY, ENT_CLIENT_AUXILIARYXHAIR);
WriteByte(MSG_ENTITY, self.cnt);
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ WriteCoord(MSG_ENTITY, self.origin.x);
+ WriteCoord(MSG_ENTITY, self.origin.y);
+ WriteCoord(MSG_ENTITY, self.origin.z);
- WriteByte(MSG_ENTITY, rint(self.colormod_x * 255));
- WriteByte(MSG_ENTITY, rint(self.colormod_y * 255));
- WriteByte(MSG_ENTITY, rint(self.colormod_z * 255));
+ WriteByte(MSG_ENTITY, rint(self.colormod.x * 255));
+ WriteByte(MSG_ENTITY, rint(self.colormod.y * 255));
+ WriteByte(MSG_ENTITY, rint(self.colormod.z * 255));
- return TRUE;
+ return true;
}
-void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, float axh_id)
+void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id)
{
if (!IS_REAL_CLIENT(own))
return;
axh.cnt = axh_id;
axh.drawonlytoclient = own;
axh.owner = own;
- Net_LinkEntity(axh, FALSE, 0, SendAuxiliaryXhair);
+ Net_LinkEntity(axh, false, 0, SendAuxiliaryXhair);
}
setorigin(axh, loc);
#if 0
void targetdrone_think();
-void targetdrone_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
+void targetdrone_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
void targetdrone_renwe()
{
self.think = targetdrone_think;
setsize(self, '-100 -100 -100', '100 100 100');
}
-void targetdrone_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void targetdrone_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
self.health -= damage;
if(self.health <= 0)
if(trace_ent.deadflag != DEAD_NO)
trace_ent = world;
-
- if(!trace_ent.vehicle_flags & VHF_ISVEHICLE ||
- trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET ||
- trace_ent.takedamage == DAMAGE_TARGETDRONE)
- trace_ent = world;
+ if(!(
+ (trace_ent.vehicle_flags & VHF_ISVEHICLE) ||
+ (trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET) ||
+ (trace_ent.takedamage == DAMAGE_TARGETDRONE)
+ )) { trace_ent = world; }
}
if(self.lock_target == world && trace_ent != world)
}
// Generic vehile projectile system
-void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
// Ignore damage from oterh projectiles from my owner (dont mess up volly's)
if(inflictor.owner == self.owner)
proj.solid = SOLID_BBOX;
proj.movetype = MOVETYPE_FLYMISSILE;
proj.flags = FL_PROJECTILE;
- proj.bot_dodge = TRUE;
+ proj.bot_dodge = true;
proj.bot_dodgerating = _dmg;
proj.velocity = _vel;
proj.touch = vehicles_projectile_explode;
self.touch = vehicles_touch;
self.event_damage = vehicles_damage;
self.reset = vehicles_reset;
- self.iscreature = TRUE;
- self.teleportable = FALSE; // no teleporting for vehicles, too buggy
- self.damagedbycontents = TRUE;
+ self.iscreature = true;
+ self.teleportable = false; // no teleporting for vehicles, too buggy
+ self.damagedbycontents = true;
self.movetype = MOVETYPE_WALK;
self.solid = SOLID_SLIDEBOX;
self.takedamage = DAMAGE_AIM;
self.deadflag = DEAD_NO;
- self.bot_attack = TRUE;
+ self.bot_attack = true;
self.flags = FL_NOTARGET;
self.avelocity = '0 0 0';
self.velocity = '0 0 0';
float vehicles_crushable(entity e)
{
if(IS_PLAYER(e))
- return TRUE;
+ return true;
if(e.flags & FL_MONSTER)
- return TRUE;
+ return true;
- return FALSE;
+ return false;
}
void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
vehicles_enter();
}
-var float autocvar_g_vehicles_allow_bots = 0;
+float autocvar_g_vehicles_allow_bots = 0;
void vehicles_enter()
{
// Remove this when bots know how to use vehicles
if(self.phase > time)
return;
+ if(other.frozen)
+ return;
+ if(other.vehicle)
+ return;
+ if(other.deadflag != DEAD_NO)
+ return;
if(teamplay)
if(self.team)
self.team = self.owner.team;
self.flags -= FL_NOTARGET;
- self.monster_attack = TRUE;
+ self.monster_attack = true;
if (IS_REAL_CLIENT(other))
{
WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
if(self.tur_head)
{
- WriteAngle(MSG_ONE, self.tur_head.angles_x + self.angles_x); // tilt
- WriteAngle(MSG_ONE, self.tur_head.angles_y + self.angles_y); // yaw
+ WriteAngle(MSG_ONE, self.tur_head.angles.x + self.angles.x); // tilt
+ WriteAngle(MSG_ONE, self.tur_head.angles.y + self.angles.y); // yaw
WriteAngle(MSG_ONE, 0); // roll
}
else
{
- WriteAngle(MSG_ONE, self.angles_x * -1); // tilt
- WriteAngle(MSG_ONE, self.angles_y); // yaw
+ WriteAngle(MSG_ONE, self.angles.x * -1); // tilt
+ WriteAngle(MSG_ONE, self.angles.y); // yaw
WriteAngle(MSG_ONE, 0); // roll
}
}
for(i = 0; i < 100; ++i)
{
v = randomvec();
- v_z = 0;
+ v.z = 0;
v = v2 + normalize(v) * mysize;
tracebox(v2, PL_MIN, PL_MAX, v, MOVE_NORMAL, self.owner);
if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid)
return;
}
- vehicles_exit_running = TRUE;
+ vehicles_exit_running = true;
if(IS_CLIENT(self))
{
_vehicle = self.vehicle;
{
_vehicle.vehicle_exit(eject);
self = _oldself;
- vehicles_exit_running = FALSE;
+ vehicles_exit_running = false;
return;
}
}
WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
WriteAngle(MSG_ONE, 0);
- WriteAngle(MSG_ONE, _vehicle.angles_y);
+ WriteAngle(MSG_ONE, _vehicle.angles.y);
WriteAngle(MSG_ONE, 0);
}
sound (_vehicle, CH_TRIGGER_SINGLE, "misc/null.wav", 1, ATTEN_NORM);
_vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle;
_vehicle.phase = time + 1;
- _vehicle.monster_attack = FALSE;
+ _vehicle.monster_attack = false;
_vehicle.vehicle_exit(eject);
_vehicle.owner = world;
self = _oldself;
- vehicles_exit_running = FALSE;
+ vehicles_exit_running = false;
}
void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
{
- if(self.regen_field < field_max)
- if(timer + rpause < time)
+ if (self.(regen_field) < field_max)
+ if (timer + rpause < time)
{
- if(_healthscale)
+ if (_healthscale)
regen = regen * (self.vehicle_health / self.tur_health);
- self.regen_field = min(self.regen_field + regen * delta_time, field_max);
+ self.(regen_field) = min(self.(regen_field) + regen * delta_time, field_max);
- if(self.owner)
- self.owner.regen_field = (self.regen_field / field_max) * 100;
+ if (self.owner)
+ self.owner.(regen_field) = (self.(regen_field) / field_max) * 100;
}
}
}
}
-void vehicles_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void vehicles_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
self.dmg_time = time;
rgb = Team_ColorRGB(self.team);
else
rgb = '1 1 1';
- WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb);
+ WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP, rgb);
if(self.waypointsprite_attached)
{
WaypointSprite_UpdateRule(self.waypointsprite_attached, self.wp00.team, SPRITERULE_DEFAULT);
setattachment(_slot.vehicle_hudmodel, _slot, "");
setattachment(_slot.vehicle_viewport, _slot.vehicle_hudmodel, "");
- return TRUE;
+ return true;
}
float vehicle_initialize(string net_name,
float _max_shield)
{
if(!autocvar_g_vehicles)
- return FALSE;
+ return false;
if(self.targetname)
{
self.tur_head = spawn();
self.tur_head.owner = self;
self.takedamage = DAMAGE_AIM;
- self.bot_attack = TRUE;
- self.iscreature = TRUE;
- self.teleportable = FALSE; // no teleporting for vehicles, too buggy
- self.damagedbycontents = TRUE;
+ self.bot_attack = true;
+ self.iscreature = true;
+ self.teleportable = false; // no teleporting for vehicles, too buggy
+ self.damagedbycontents = true;
self.hud = vhud;
self.tur_health = _max_health;
self.tur_head.tur_health = _max_shield;
self.tur_head.team = self.team;
if(MUTATOR_CALLHOOK(VehicleSpawn))
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname,
vtag = gettaginfo(_turrret, gettagindex(_turrret, _tagname));
vtmp = vectoangles(normalize(_target - vtag));
vtmp = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(_vehic.angles), AnglesTransform_FromAngles(vtmp))) - _turrret.angles;
- vtmp = AnglesTransform_Normalize(vtmp, TRUE);
+ vtmp = AnglesTransform_Normalize(vtmp, true);
ftmp = _aimspeed * frametime;
- vtmp_y = bound(-ftmp, vtmp_y, ftmp);
- vtmp_x = bound(-ftmp, vtmp_x, ftmp);
- _turrret.angles_y = bound(_rotlimit_min, _turrret.angles_y + vtmp_y, _rotlimit_max);
- _turrret.angles_x = bound(_pichlimit_min, _turrret.angles_x + vtmp_x, _pichlimit_max);
+ vtmp.y = bound(-ftmp, vtmp.y, ftmp);
+ vtmp.x = bound(-ftmp, vtmp.x, ftmp);
+ _turrret.angles_y = bound(_rotlimit_min, _turrret.angles.y + vtmp.y, _rotlimit_max);
+ _turrret.angles_x = bound(_pichlimit_min, _turrret.angles.x + vtmp.x, _pichlimit_max);
return vtag;
}