void vehicles_setreturn();
-/** AuxiliaryXhair*
+/** AuxiliaryXhair*
Send addictional points of interest to be drawn, to vehicle owner
**/
float MAX_AXH = 4;
}
/** vehicles_locktarget
-
+
Generic target locking.
-
+
Figure out if what target is "locked" (if any), for missile tracking as such.
-
+
after calling, "if(self.lock_target != world && self.lock_strength == 1)" mean
you have a locked in target.
-
+
Exspects a crosshair_trace() or equivalent to be
dont before calling.
-
+
**/
.entity lock_target;
.float lock_strength;
}
#define VEHICLE_UPDATE_PLAYER(fld,vhname) \
-self.owner.vehicle_##fld = self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld
+self.owner.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
#define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
return v_forward * force_fromtag_power;
}
-// Experimental hovermode wich uses attraction/repulstion from surface unsted of gravity/repulsion
+// Experimental hovermode wich uses attraction/repulstion from surface insted of gravity/repulsion
// Can possibly be use to move abt any surface (inclusing walls/celings)
vector vehicles_force_fromtag_maglev(string tag_name, float spring_length, float max_power)
{
entity vehicles_projectile(string _mzlfx, string _mzlsound,
vector _org, vector _vel,
float _dmg, float _radi, float _force, float _size,
- float _deahtype, float _projtype, float _health,
+ float _deahtype, float _projtype, float _health,
float _cull, float _clianim)
{
entity proj;
// De-own & reset
self.vehicle_hudmodel.viewmodelforclient = self;
-
+
self.owner = world;
self.touch = vehicles_touch;
self.event_damage = vehicles_damage;
self.bot_attack = TRUE;
self.flags = FL_NOTARGET;
self.avelocity = '0 0 0';
+ self.velocity = '0 0 0';
// Reset locking
self.lock_strength = 0;
self.owner = other;
self.switchweapon = other.switchweapon;
-
+
// .viewmodelforclient works better.
//self.vehicle_hudmodel.drawonlytoclient = self.owner;
- self.vehicle_hudmodel.viewmodelforclient = self.owner;
-
+#ifndef VEHICLES_CSQC
+ self.vehicle_hudmodel.viewmodelforclient = self.owner;
+#endif
+
self.event_damage = vehicles_damage;
self.nextthink = 0;
self.owner.angles = self.angles;
self.owner.vehicle_reload1 = self.vehicle_reload1;
self.owner.vehicle_reload2 = self.vehicle_reload2;
- // Cnnt do this, hides attached objects too.
+ // Cant do this, hides attached objects too.
//self.exteriormodeltoclient = self.owner;
//self.tur_head.exteriormodeltoclient = self.owner;
self.team = self.owner.team;
self.flags -= FL_NOTARGET;
+#ifndef VEHICLES_CSQC
msg_entity = other;
WriteByte (MSG_ONE, SVC_SETVIEWPORT);
WriteEntity(MSG_ONE, self.vehicle_viewport);
WriteAngle(MSG_ONE, self.angles_y); // yaw
WriteAngle(MSG_ONE, 0); // roll
}
+#endif
+//#endif
vehicles_clearrturn();
WriteByte (MSG_ONE, SVC_SETVIEWPORT);
WriteEntity( MSG_ONE, self.owner);
- WriteByte (MSG_ONE, SVC_SETVIEWANGLES); // 10 = SVC_SETVIEWANGLES
- WriteAngle(MSG_ONE, 0); // tilt
+ WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
+ WriteAngle(MSG_ONE, 0); // pich
WriteAngle(MSG_ONE, self.angles_y); // yaw
WriteAngle(MSG_ONE, 0); // roll
self.regen_field = min(self.regen_field + regen * delta_time, field_max);
if(self.owner)
- self.owner.regen_field = self.regen_field / field_max;
+ self.owner.regen_field = (self.regen_field / field_max) * 100;
}
}
if(autocvar_g_fullbrightplayers)
_effects |= EF_FULLBRIGHT;
-
+
if(self.team)
_colormap = 1024 + (self.team - 1) * 17;
else
_colormap = 1024;
- _glowmod = '0 0 0';
- _colormod = '0 0 0';
+ _glowmod = '0 0 0';
+ _colormod = '0 0 0';
// Find all ents attacked to main model and setup effects, colormod etc.
e = findchainentity(tag_entity, self);
}
e = e.chain;
}
-
+
self.vehicle_hudmodel.effects = self.effects = _effects | EF_LOWPRECISION;
self.vehicle_hudmodel.colormod = self.colormod = _colormod;
self.vehicle_hudmodel.colormap = self.colormap = _colormap;
self.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
- self.alpha = 1;
- self.avelocity = '0 0 0';
- self.velocity = '0 0 0';
- self.effects = _effects;
+ self.alpha = 1;
+ self.avelocity = '0 0 0';
+ self.velocity = '0 0 0';
+ self.effects = _effects;
}
float vehicle_initialize(string net_name,
string hudtag,
string viewtag,
float vhud,
- vector min_s,
- vector max_s,
- float nodrop,
+ vector min_s,
+ vector max_s,
+ float nodrop,
void() spawnproc,
float _respawntime,
float() physproc,
void() enterproc,
void(float extflag) exitfunc,
void() dieproc,
- void() thinkproc )
+ void() thinkproc,
+ float use_csqc)
{
addstat(STAT_HUD, AS_INT, hud);
- addstat(STAT_VEHICLESTAT_HEALTH, AS_FLOAT, vehicle_health);
- addstat(STAT_VEHICLESTAT_SHIELD, AS_FLOAT, vehicle_shield);
- addstat(STAT_VEHICLESTAT_ENERGY, AS_FLOAT, vehicle_energy);
+ addstat(STAT_VEHICLESTAT_HEALTH, AS_INT, vehicle_health);
+ addstat(STAT_VEHICLESTAT_SHIELD, AS_INT, vehicle_shield);
+ addstat(STAT_VEHICLESTAT_ENERGY, AS_INT, vehicle_energy);
addstat(STAT_VEHICLESTAT_AMMO1, AS_INT, vehicle_ammo1);
- addstat(STAT_VEHICLESTAT_RELOAD1, AS_FLOAT, vehicle_reload1);
+ addstat(STAT_VEHICLESTAT_RELOAD1, AS_INT, vehicle_reload1);
addstat(STAT_VEHICLESTAT_AMMO2, AS_INT, vehicle_ammo2);
- addstat(STAT_VEHICLESTAT_RELOAD2, AS_FLOAT, vehicle_reload2);
+ addstat(STAT_VEHICLESTAT_RELOAD2, AS_INT, vehicle_reload2);
if(bodymodel == "")
error("vehicles: missing bodymodel!");
tracebox(self.origin + '0 0 100', min_s, max_s, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
setorigin(self, trace_endpos);
}
-
- //self.vehicle_hudmodel.effects = EF_NODEPTHTEST;
+
self.pos1 = self.origin;
self.pos2 = self.angles;
-
+#ifdef VEHICLES_CSQC
+ if(use_csqc)
+ net_link_vehile();
+#endif
return TRUE;
}
self.vehicle_spawn = self.vehicle_exit;
self.AuxiliaryXhair = self.AuxiliaryXhair;
}
-
-#ifdef VEHICLES_CSQC
-// SendFlags
-float VSF_SETUP = 2; /// Send vehicle type etc
-float VSF_ORIGIN = 4; /// Send location
-float VSF_MOVEMENT = 8; /// Send movement update (and angle/avelocity)
-float VSF_STATS = 16; /// Send ammo, health etc
-float VSF_EXTRA = 32; /// Send additional data (turret rotations and such) handeld per vehicle type.
-float VSF_FULL_UPDATE = 16777215 /// Send everything
-
-
-#ifdef SVQC
-float send_vehile(entity to, float sf)
-{
- WriteByte(MSG_ENTITY, ENT_CLIENT_VEHICLE);
-
- WriteByte(MSG_ENTITY, sf);
-
- if(sf & VSF_SETUP)
- {
- WriteByte(MSG_ENTITY, self.hud); //vehicle type = hud
- WriteByte(MSG_ENTITY, self.team);
- WriteShort(MSG_ENTITY, self.colormap);
- }
-
- if(sf & VSF_ORIGIN)
- {
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
- }
-
- if(sf & VSF_MOVEMENT)
- {
- WriteCoord(MSG_ENTITY, self.velocity_x);
- WriteCoord(MSG_ENTITY, self.velocity_y);
- WriteCoord(MSG_ENTITY, self.velocity_z);
-
- WriteAngle(MSG_ENTITY, self.angles_x);
- WriteAngle(MSG_ENTITY, self.angles_y);
- WriteAngle(MSG_ENTITY, self.angles_z);
-
- WriteCoord(MSG_ENTITY, self.avelocity_x);
- WriteCoord(MSG_ENTITY, self.avelocity_y);
- WriteCoord(MSG_ENTITY, self.avelocity_z);
- }
-
- if(sf & VSF_STATS)
- {
- WriteShort(MSG_ENTITY, self.vehicle_health);
- WriteShort(MSG_ENTITY, self.vehicle_shield);
- WriteShort(MSG_ENTITY, self.vehicle_energy);
- WriteShort(MSG_ENTITY, self.vehicle_ammo1);
- WriteShort(MSG_ENTITY, self.vehicle_reload1);
- WriteShort(MSG_ENTITY, self.vehicle_ammo2);
- WriteShort(MSG_ENTITY, self.vehicle_reload2);
- }
-
- if(sf & VSF_EXTRA)
- {
- self.vehile_send_exta(to);
- }
-
- return TRUE;
-}
-
-void net_link_vehile()
-{
- self.SendFlags = 0xFFFFFF;
- Net_LinkEntity(self, FALSE, 0, send_vehile);
-}
-#endif // SVQC
-
-#ifdef CSQC
-void Net_ReadVehicle(float bIsNew)
-{
- float sf;
-
- sf = ReadByte();
-
- if(sf & VSF_SETUP)
- {
- float vhtype;
- vhtype = ReadByte();
-
- }
-
- if(bIsNew)
- {
- setmodel(self, "models/vehicles/wakizashi.dpm");
- self.move_movetype = MOVETYPE_BOUNCE;
- self.entremove = VehicleRacerRemove;
- setsize(self, '-60 -60 -20', '60 60 20');
- self.draw = VehicleRacerDraw;
- self.scale = 0.5;
- }
-
- self.cnt = ReadByte();
-
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
-
- self.velocity_x = ReadCoord();
- self.velocity_y = ReadCoord();
- self.velocity_z = ReadCoord();
-
- self.angles_x = ReadAngle();
- self.angles_y = ReadAngle();
- self.angles_z = ReadAngle();
-
- self.move_origin = self.origin;
- self.move_velocity = self.velocity;
- self.move_angles = self.angles;
-}
-#endif // CSQC
-
-#endif // VEHICLES_CSQC