psize = 0.5 * drawgetimagesize(SPIDER_CROSS2);
loc = project_3d_to_2d(self.origin) - 0.5 * psize;
- loc_z = 0;
- psize_z = 0;
- drawpic(loc, SPIDER_CROSS2, psize, '0 1 1', 1, DRAWFLAG_ADDITIVE);
+ if not (loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight)
+ {
+ loc_z = 0;
+ psize_z = 0;
+ drawpic(loc, SPIDER_CROSS2, psize, self.colormod, 1, DRAWFLAG_ADDITIVE);
+ }
if(time - self.cnt > 0.1)
remove(self);
AuxiliaryXhair.origin_x = ReadCoord();
AuxiliaryXhair.origin_y = ReadCoord();
AuxiliaryXhair.origin_z = ReadCoord();
+
+ AuxiliaryXhair.colormod_x = ReadByte() / 255;
+ AuxiliaryXhair.colormod_y = ReadByte() / 255;
+ AuxiliaryXhair.colormod_z = ReadByte() / 255;
+
AuxiliaryXhair.drawmask = MASK_NORMAL;
AuxiliaryXhair.cnt = time;
float movedt;
vector where;
+
if(!dropmark)
{
dropmark = spawn();
float autocvar_g_vehicle_raptor_guns_pitchlimit_up;
float autocvar_g_vehicle_raptor_guns_pitchlimit_down;
+float autocvar_g_vehicle_raptor_cannon_locktarget;
+float autocvar_g_vehicle_raptor_cannon_predicttarget;
float autocvar_g_vehicle_raptor_cannon_cost;
float autocvar_g_vehicle_raptor_cannon_damage;
float autocvar_g_vehicle_raptor_cannon_radius;
// Aim the gunz
crosshair_trace(player);
+ vector vf, ad;
+ if(autocvar_g_vehicle_raptor_cannon_locktarget)
+ {
+ if(trace_ent)
+ {
+ if(raptor.gun2.enemy != world)
+ {
+ if(raptor.gun2.enemy == trace_ent)
+ raptor.gun2.cnt += 1;
+ else
+ raptor.gun2.cnt -= 1;
+ }
+
+ raptor.gun2.enemy = trace_ent;
+
+ if(raptor.gun2.cnt < 0)
+ {
+ raptor.gun2.enemy = world;
+ raptor.gun2.cnt = 0;
+ }
+
+ if(raptor.gun2.cnt > 50)
+ {
+ raptor.gun2.enemy = world;
+ raptor.gun2.cnt = 0;
+
+ raptor.gun1.enemy = trace_ent;
+ raptor.gun1.cnt = time + 1;
+ }
+
+ // Allready have a lock?
+ if(raptor.gun1.enemy != world)
+ {
+ // Add 0.5 secs of tracking for each trace hit
+ if(trace_ent == raptor.gun1.enemy)
+ raptor.gun1.cnt = min(raptor.gun1.cnt + 0.25, time + 5);
+
+ if(raptor.gun1.cnt < time)
+ raptor.gun1.enemy = world;
+ }
+ }
+ else
+ raptor.gun2.cnt = max(raptor.gun2.cnt - 1, 0);
+
+ if(raptor.gun1.cnt - time < 0)
+ raptor.gun1.enemy = world;
+
+ if(autocvar_g_vehicle_raptor_cannon_predicttarget)
+ {
+ vector o;
+ if(raptor.gun1.enemy != world)
+ {
+ float i, distance, impact_time;
+
+ vf = real_origin(raptor.gun1.enemy);
+ ad = vf;
+ o = raptor.origin;
+ for(i = 0; i < 4; ++i)
+ {
+
+ distance = vlen(ad - o);
+ impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
+ ad = vf + raptor.gun1.enemy.velocity * impact_time;
+ o = raptor.origin + raptor.velocity * impact_time;
+ }
+ trace_endpos = ad;
+
+ }
+ }
+ else
+ trace_endpos = real_origin(raptor.gun1.enemy);
+ }
+
ftmp2 = autocvar_g_vehicle_raptor_guns_turnspeed * frametime;
ftmp = -ftmp2;
- vector vf, ad;
// Gun1
df = gettaginfo(raptor.gun1, gettagindex(raptor.gun1, "fire1"));
ad += df;
raptor.gun2.angles_y = bound(-autocvar_g_vehicle_raptor_guns_turnlimit, df_y + raptor.gun2.angles_y, autocvar_g_vehicle_raptor_guns_turnlimit);
- ad = ad * 0.5;
- v_forward = vf * 0.5;
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, raptor);
- SpawnOrUpdateAuxiliaryXhair(player, trace_endpos);
+ if(autocvar_g_vehicle_raptor_cannon_locktarget)
+ {
+ if(raptor.gun1.enemy)
+ {
+ SpawnOrUpdateAuxiliaryXhair(player, trace_endpos, '1 0 0');
+ }
+ else
+ {
+ ad = ad * 0.5;
+ v_forward = vf * 0.5;
+ traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, raptor);
+
+ if(raptor.gun2.enemy != world)
+ {
+ ftmp = raptor.gun2.cnt / 50;
+ SpawnOrUpdateAuxiliaryXhair(player, trace_endpos, '1 0 0' * ftmp + '1 1 1' * (1 - ftmp));
+ }
+ else
+ SpawnOrUpdateAuxiliaryXhair(player, trace_endpos, '1 1 1');
+
+ }
+ }
+ else
+ SpawnOrUpdateAuxiliaryXhair(player, trace_endpos, '1 1 1');
if(player.BUTTON_ATCK)
if(raptor.attack_finished_single <= time)
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));
+
return TRUE;
}
-void SpawnOrUpdateAuxiliaryXhair(entity own, vector loc)
+void SpawnOrUpdateAuxiliaryXhair(entity own, vector loc, vector clr)
{
if(own.AuxiliaryXhair == world || wasfreed(own.AuxiliaryXhair))
{
own.AuxiliaryXhair = spawn();
own.AuxiliaryXhair.owner = own;
- //own.AuxiliaryXhair.customizeentityforclient = AuxiliaryXhair_customizeentityforclient;
own.AuxiliaryXhair.drawonlytoclient = own;
- setorigin(own.AuxiliaryXhair, loc);
Net_LinkEntity(own.AuxiliaryXhair, FALSE, 0, AuxiliaryXhair_SendEntity);
- return;
}
+ own.AuxiliaryXhair.colormod = clr;
setorigin(own.AuxiliaryXhair, loc);
own.AuxiliaryXhair.SendFlags |= 0x01;
}
void Release_AuxiliaryXhair(entity from)
{
// from.AuxiliaryXhair.drawonlytoclient = from.AuxiliaryXhair;
- if not (from.AuxiliaryXhair == world || wasfreed(from.AuxiliaryXhair))
+ if (from.AuxiliaryXhair != world && !wasfreed(from.AuxiliaryXhair))
remove(from.AuxiliaryXhair);
from.AuxiliaryXhair = world;