r4830 - in trunk/data: models models/weapons qcsrc/common qcsrc/server textures

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Oct 23 06:48:56 EDT 2008


Author: tzork
Date: 2008-10-23 06:48:56 -0400 (Thu, 23 Oct 2008)
New Revision: 4830

Added:
   trunk/data/models/tagrocket.md3
   trunk/data/models/tagrocket.tga
   trunk/data/models/weapons/g_hlac.md3
   trunk/data/models/weapons/g_seeker.md3
   trunk/data/models/weapons/v_hlac.md3
   trunk/data/models/weapons/v_seeker.md3
   trunk/data/models/weapons/w_hlac.zym
   trunk/data/models/weapons/w_seeker.zym
   trunk/data/qcsrc/server/w_hlac.qc
   trunk/data/qcsrc/server/w_seeker.qc
   trunk/data/textures/hlac.tga
   trunk/data/textures/seeker.tga
Modified:
   trunk/data/qcsrc/common/constants.qh
   trunk/data/qcsrc/server/cl_weapons.qc
   trunk/data/qcsrc/server/progs.src
   trunk/data/qcsrc/server/t_items.qc
Log:
HLAC and Tag Seeker weapons.

Added: trunk/data/models/tagrocket.md3
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/tagrocket.md3
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/tagrocket.tga
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/tagrocket.tga
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/weapons/g_hlac.md3
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/weapons/g_hlac.md3
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/weapons/g_seeker.md3
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/weapons/g_seeker.md3
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/weapons/v_hlac.md3
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/weapons/v_hlac.md3
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/weapons/v_seeker.md3
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/weapons/v_seeker.md3
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/weapons/w_hlac.zym
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/weapons/w_hlac.zym
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/models/weapons/w_seeker.zym
===================================================================
(Binary files differ)


Property changes on: trunk/data/models/weapons/w_seeker.zym
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh	2008-10-23 09:38:00 UTC (rev 4829)
+++ trunk/data/qcsrc/common/constants.qh	2008-10-23 10:48:56 UTC (rev 4830)
@@ -313,9 +313,11 @@
 float WEP_ROCKET_LAUNCHER	=  9; float WEPBIT_ROCKET_LAUNCHER	= 256;
 float WEP_PORTO				= 10; float WEPBIT_PORTO			= 512;
 float WEP_MINSTANEX			= 11; float WEPBIT_MINSTANEX		= 1024;
-float WEP_HOOK     			= 12; float WEPBIT_HOOK     		= 2048;
-float WEP_LAST				= 12; float WEPBIT_ALL              = 4095;
-float WEP_COUNT             = 13;
+float WEP_HOOK     			= 12; float WEPBIT_HOOK     		= 2048;
+float WEP_HLAC			    = 13; float WEPBIT_HLAC		        = 4096;
+float WEP_SEEKER			= 14; float WEPBIT_SEEKER		    = 8192;
+float WEP_LAST				= 14; float WEPBIT_ALL              = 16383;
+float WEP_COUNT             = 15;
 
 float	IT_UNLIMITED_AMMO       = 1;
 // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.

Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc	2008-10-23 09:38:00 UTC (rev 4829)
+++ trunk/data/qcsrc/server/cl_weapons.qc	2008-10-23 10:48:56 UTC (rev 4830)
@@ -120,7 +120,7 @@
 }
 
 float w_getbestweapon(entity e)
-{ 
+{
 	return W_GetCycleWeapon(e, e.cvar_cl_weaponpriority, 0, -1, 0);
 };
 
@@ -452,5 +452,9 @@
 	register_weapon(WEP_PORTO,            w_porto,     IT_SUPERWEAPON, 0, 0,     0, "porto" ,    "porto",           "Port-O-Launch");
 	register_weapon(WEP_MINSTANEX,        w_minstanex, IT_CELLS,       7, 0, 10000, "minstanex", "minstanex",       "MinstaNex");
 	register_weapon(WEP_HOOK,             w_hook,      IT_CELLS,       0, 0,     0, "hookgun",   "hook",            "Grappling Hook");
+
+	register_weapon(WEP_SEEKER,           w_seeker,    IT_ROCKETS,     0, 0,     0, "seeker",     "seeker",         "T.A.G. Seeker");
+	register_weapon(WEP_HLAC,             w_hlac,      IT_CELLS,       0, 0,     0, "hlac",       "hlac",           "Heavy Laser Assault Cannon");
+
 	register_weapons_done();
 }

Modified: trunk/data/qcsrc/server/progs.src
===================================================================
--- trunk/data/qcsrc/server/progs.src	2008-10-23 09:38:00 UTC (rev 4829)
+++ trunk/data/qcsrc/server/progs.src	2008-10-23 10:48:56 UTC (rev 4830)
@@ -84,6 +84,8 @@
 w_rocketlauncher.qc
 w_porto.qc
 w_hook.qc
+w_hlac.qc
+w_seeker.qc
 
 t_items.qc
 cl_weapons.qc

Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc	2008-10-23 09:38:00 UTC (rev 4829)
+++ trunk/data/qcsrc/server/t_items.qc	2008-10-23 10:48:56 UTC (rev 4830)
@@ -700,7 +700,12 @@
 	weapon_defaultspawnfunc(WEP_HLAC);
 }
 
+void spawnfunc_weapon_seeker (void)
+{
+	weapon_defaultspawnfunc(WEP_SEEKER);
+}
 
+
 void spawnfunc_weapon_rocketlauncher (void)
 {
 	if (g_minstagib)

Added: trunk/data/qcsrc/server/w_hlac.qc
===================================================================
--- trunk/data/qcsrc/server/w_hlac.qc	                        (rev 0)
+++ trunk/data/qcsrc/server/w_hlac.qc	2008-10-23 10:48:56 UTC (rev 4830)
@@ -0,0 +1,252 @@
+.float HLAC_bulletcounter;
+void W_HLAC_Touch (void)
+{
+	vector	dir;
+	vector org2;
+	vector normal;
+
+	if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
+	{
+		remove(self);
+		return;
+	}
+
+	if (other == self.owner)
+		return;
+
+	normal = trace_plane_normal;
+	dir = normalize (self.owner.origin - self.origin);
+	org2 = findbetterlocation (self.origin, 8);
+
+	pointparticles(particleeffectnum("laser_impact"), org2, normal * 1000, 1);
+
+	self.event_damage = SUB_Null;
+
+    RadiusDamage (self, self.owner, cvar("g_balance_hlac_primary_damage"), cvar("g_balance_hlac_primary_edgedamage"), cvar("g_balance_hlac_primary_radius"), world, cvar("g_balance_hlac_primary_force"), WEP_HLAC, other);
+	sound (self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
+
+	remove (self);
+}
+
+void W_HLAC_Touch2 (void)
+{
+	vector	dir;
+	vector org2;
+	vector normal;
+
+	if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
+	{
+		remove(self);
+		return;
+	}
+
+	if (other == self.owner)
+		return;
+
+	normal = trace_plane_normal;
+	dir = normalize (self.owner.origin - self.origin);
+	org2 = findbetterlocation (self.origin, 8);
+
+	pointparticles(particleeffectnum("laser_impact"), org2, normal * 1000, 1);
+
+	//self.event_damage = SUB_Null;
+
+    RadiusDamage (self, self.owner, cvar("g_balance_hlac_secondary_damage"), cvar("g_balance_hlac_secondary_edgedamage"), cvar("g_balance_hlac_secondary_radius"), world, cvar("g_balance_hlac_secondary_force"), WEP_HLAC, other);
+	sound (self, CHAN_PROJECTILE, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
+
+	remove (self);
+}
+
+void W_HLAC_Attack (void)
+{
+	local entity missile;
+    float spread;
+
+    if not(self.items & IT_UNLIMITED_AMMO)
+    {
+        self.ammo_cells = self.ammo_cells - cvar("g_balance_hlac_primary_ammo");
+    }
+
+    spread = cvar("g_balance_hlac_primary_spread_min") + (cvar("g_balance_hlac_primary_spread_add") * self.HLAC_bulletcounter);
+    spread = min(spread,cvar("g_balance_hlac_primary_spread_max"));
+    if(self.crouch)
+        spread = spread * cvar("g_balance_hlac_primary_spread_crouchmod");
+
+	W_SetupShot (self, '25 8 -8', FALSE, 3, "weapons/lasergun_fire.wav");
+	pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
+	if (!g_norecoil)
+	{
+		self.punchangle_x = random () - 0.5;
+		self.punchangle_y = random () - 0.5;
+	}
+
+	missile = spawn ();
+	missile.owner = self;
+	missile.classname = "hlacbolt";
+	// missile.dmg = issecondary;
+	missile.bot_dodge = TRUE;
+
+    missile.bot_dodgerating = cvar("g_balance_hlac_primary_damage");
+
+	missile.movetype = MOVETYPE_FLY;
+	missile.solid = SOLID_BBOX;
+
+	setmodel (missile, "models/laser.mdl"); // precision set below
+	setsize (missile, '0 0 0', '0 0 0');
+	setorigin (missile, w_shotorg);
+
+    missile.velocity = (w_shotdir + randomvec() * spread) * cvar("g_balance_hlac_primary_speed");
+
+	W_SetupProjectileVelocity(missile);
+	missile.angles = vectoangles (missile.velocity);
+
+	missile.touch = W_HLAC_Touch;
+	missile.think = SUB_Remove;
+
+    missile.nextthink = time + cvar("g_balance_hlac_primary_lifetime");
+
+	missile.effects = EF_LOWPRECISION;
+	missile.flags = FL_PROJECTILE;
+}
+
+void W_HLAC_Attack2f (void)
+{
+	local entity missile;
+    float spread;
+
+    spread = cvar("g_balance_hlac_secondary_spread");
+
+
+    if(self.crouch)
+        spread = spread * cvar("g_balance_hlac_secondary_spread_crouchmod");
+
+	W_SetupShot (self, '25 8 -8', FALSE, 3, "weapons/lasergun_fire.wav");
+	pointparticles(particleeffectnum("laser_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
+
+	missile = spawn ();
+	missile.owner = self;
+	missile.classname = "hlacbolt";
+	// missile.dmg = issecondary;
+	missile.bot_dodge = TRUE;
+
+    missile.bot_dodgerating = cvar("g_balance_hlac_secondary_damage");
+
+	missile.movetype = MOVETYPE_FLY;
+	missile.solid = SOLID_BBOX;
+
+	setmodel (missile, "models/laser.mdl"); // precision set below
+	setsize (missile, '0 0 0', '0 0 0');
+	setorigin (missile, w_shotorg);
+
+    missile.velocity = (w_shotdir + randomvec() * spread) * cvar("g_balance_hlac_secondary_speed");
+
+	W_SetupProjectileVelocity(missile);
+	missile.angles = vectoangles (missile.velocity);
+
+	missile.touch = W_HLAC_Touch2;
+	missile.think = SUB_Remove;
+
+    missile.nextthink = time + cvar("g_balance_hlac_secondary_lifetime");
+
+	missile.effects = EF_LOWPRECISION;
+	missile.flags = FL_PROJECTILE;
+}
+
+void W_HLAC_Attack2 (void)
+{
+    float i;
+
+    if not(self.items & IT_UNLIMITED_AMMO)
+    {
+        self.ammo_cells = self.ammo_cells - cvar("g_balance_hlac_secondary_ammo");
+    }
+
+    for(i=0;i<6;++i)
+        W_HLAC_Attack2f();
+
+	if (!g_norecoil)
+	{
+		self.punchangle_x = random () - 0.5;
+		self.punchangle_y = random () - 0.5;
+	}
+
+	// ATTACK_FINISHED(self) = time + cvar("g_balance_hlac_secondary_refire");
+}
+
+
+// weapon frames
+void HLAC_fire1_02()
+{
+	if(self.weapon != self.switchweapon) // abort immediately if switching
+	{
+		w_ready();
+		return;
+	}
+
+	if (self.BUTTON_ATCK)
+	{
+		if (!weapon_action(self.weapon, WR_CHECKAMMO1))
+		{
+			W_SwitchWeapon_Force(self, w_getbestweapon(self));
+			w_ready();
+			return;
+		}
+
+		ATTACK_FINISHED(self) = time + cvar("g_balance_hlac_primary_refire");
+		W_HLAC_Attack();
+		self.HLAC_bulletcounter = self.HLAC_bulletcounter + 1;
+        weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_refire"), HLAC_fire1_02);
+	}
+	else
+	{
+		weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_animtime"), w_ready);
+	}
+};
+
+void spawnfunc_weapon_hlac(); // defined in t_items.qc
+
+float w_hlac(float req)
+{
+	if (req == WR_AIM)
+        self.BUTTON_ATCK = bot_aim(cvar("g_balance_hlac_primary_speed"), 0, cvar("g_balance_hlac_primary_lifetime"), FALSE);
+	else if (req == WR_THINK)
+	{
+		if (self.BUTTON_ATCK)
+		if (weapon_prepareattack(0, cvar("g_balance_hlac_primary_refire")))
+		{
+			self.HLAC_bulletcounter = 0;
+			W_HLAC_Attack();
+			weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hlac_primary_refire"), HLAC_fire1_02);
+		}
+
+		if (self.BUTTON_ATCK2)
+		if (weapon_prepareattack(1, cvar("g_balance_hlac_secondary_refire")))
+		{
+			W_HLAC_Attack2();
+			weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_hlac_secondary_animtime"), w_ready);
+		}
+
+	}
+	else if (req == WR_PRECACHE)
+	{
+	    precache_sound ("weapons/laserimpact.wav");
+        precache_sound ("weapons/lasergun_fire.wav");
+
+        precache_model ("models/weapons/g_hlac.md3");
+		precache_model ("models/weapons/v_hlac.md3");
+		precache_model ("models/weapons/w_hlac.zym");
+		precache_sound ("weapons/lasergun_fire.wav");
+
+	}
+	else if (req == WR_SETUP)
+		weapon_setup(WEP_HLAC);
+	else if (req == WR_CHECKAMMO1)
+		return self.ammo_cells >= cvar("g_balance_hlac_primary_ammo");
+	else if (req == WR_CHECKAMMO2)
+		return self.ammo_cells >= cvar("g_balance_hlac_secondary_ammo");
+	else if (req == WR_SUICIDEMESSAGE)
+		w_deathtypestring = "should have used a smaller gun";
+	else if (req == WR_KILLMESSAGE)
+		w_deathtypestring = "was cut down by";
+	return TRUE;
+};

Added: trunk/data/qcsrc/server/w_seeker.qc
===================================================================
--- trunk/data/qcsrc/server/w_seeker.qc	                        (rev 0)
+++ trunk/data/qcsrc/server/w_seeker.qc	2008-10-23 10:48:56 UTC (rev 4830)
@@ -0,0 +1,508 @@
+//.float speed; = switchweapon
+//.float proxytime; = autoswitch
+//.float tl; = wait
+
+void Seeker_Missile_Explode ()
+{
+    vector	org2;
+    float b;
+    org2 = findbetterlocation (self.origin, 12);
+    te_explosion (org2);
+
+    b = crandom();
+    if (b<-0.7)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp1.ogg", 1, ATTN_NORM);
+    else if (b<0.4)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp2.ogg", 1, ATTN_NORM);
+    else if (b<1)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp3.ogg", 1, ATTN_NORM);
+
+    self.event_damage = SUB_Null;
+    RadiusDamage (self, self.owner, cvar("g_balance_seeker_missile_damage"), cvar("g_balance_seeker_missile_edgedamage"), cvar("g_balance_seeker_missile_radius"), world, cvar("g_balance_seeker_missile_force"), self.projectiledeathtype, other);
+
+    remove (self);
+}
+
+void Seeker_Missile_Touch()
+{
+    if (other == self.owner)
+        return;
+
+    Seeker_Missile_Explode();
+}
+
+void Seeker_Missile_Think()
+{
+    entity e;
+    vector desireddir, olddir, newdir;
+    float turnrate;
+    float dist;
+
+    if (time > self.cnt)
+        Seeker_Missile_Explode();
+
+    if (!self.switchweapon)
+        self.switchweapon = cvar("g_balance_seeker_missile_speed");
+
+    if ((self.switchweapon < cvar("g_balance_seeker_missile_speed_max")) && cvar("g_balance_seeker_missile_speed_accel"))
+        self.switchweapon = self.switchweapon * cvar("g_balance_seeker_missile_accel");
+
+    if (self.switchweapon > cvar("g_balance_seeker_missile_speed_max"))
+        self.switchweapon = self.switchweapon * cvar("g_balance_seeker_missile_decel");
+
+    if (self.enemy != world)
+    {
+        e               = self.enemy;
+        turnrate        = cvar("g_balance_seeker_missile_turnrate");		    // how fast to turn
+        desireddir      = normalize(e.origin - self.origin);
+        olddir          = normalize(self.velocity);				            // get my current direction
+        dist            = vlen(e.origin - self.origin);
+
+        // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
+        if (cvar("g_balance_seeker_missile_smart") && (dist > cvar("g_balance_seeker_missile_smart_mindist")))
+        {
+            // Is it a better idea (shorter distance) to trace to the target itself?
+            if ( vlen(self.origin + olddir * self.wait) < dist)
+                traceline(self.origin, self.origin + olddir * self.wait, FALSE, self);
+            else
+                traceline(self.origin, self.enemy.origin, FALSE, self);
+
+            // Setup adaptive tracelength
+            self.wait = vlen(self.origin - trace_endpos);
+            if (self.wait < cvar("g_balance_seeker_missile_smart_trace_min")) self.wait = cvar("g_balance_seeker_missile_smart_trace_min");
+            if (self.wait > cvar("g_balance_seeker_missile_smart_trace_max")) self.wait = cvar("g_balance_seeker_missile_smart_trace_max");
+
+            // Calc how important it is that we turn and add this to the desierd (enemy) dir.
+            desireddir  = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
+        }
+
+        //newdir = normalize((olddir + desireddir * turnrate) * 0.5);// take the average of the 2 directions; not the best method but simple & easy
+        newdir = normalize(olddir + desireddir * turnrate);// take the average of the 2 directions; not the best method but simple & easy
+
+        self.velocity = newdir * self.switchweapon;			                    // make me fly in the new direction at my flight speed
+    }
+
+    // Proxy
+    if (cvar("g_balance_seeker_missile_proxy"))
+    {
+        if ( dist <= cvar("g_balance_seeker_missile_proxy_maxrange"))
+        {
+            if (self.autoswitch == 0)
+            {
+                self.autoswitch = time + cvar("g_balance_seeker_missile_proxy_delay");
+            }
+            else
+            {
+                if (self.autoswitch <= time)
+                {
+                    Seeker_Missile_Explode();
+                    self.autoswitch = 0;
+                }
+            }
+        }
+        else
+        {
+            if (self.autoswitch != 0)
+                self.autoswitch = 0;
+        }
+    }
+    ///////////////
+
+    if (self.enemy.deadflag != DEAD_NO)
+    {
+        self.enemy = world;
+        self.cnt = time + 1 + (random() * 4);
+        self.nextthink = self.cnt;
+        return;
+    }
+
+    self.angles = vectoangles(self.velocity);			// turn model in the new flight direction
+    self.nextthink = time + 0.05;
+
+}
+
+
+
+void Seeker_Missile_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+
+    float d;
+    d = damage;
+
+    if (self.owner == attacker)
+        d = d * 0.25;
+
+    self.health = self.health - d;
+
+    if (self.health <= 0)
+        Seeker_Missile_Explode();
+}
+
+#define EF_ROCKET				16777216
+void Seeker_Missile_Animate()
+{
+    self.frame = self.frame +1;
+    self.nextthink = time + 0.05;
+
+    if(self.frame == 5)
+    {   self.think           = Seeker_Missile_Think;
+        self.nextthink       = time + cvar("g_balance_seeker_missile_activate_delay");
+        self.effects         = EF_LOWPRECISION | EF_NOSHADOW | EF_ROCKET;
+
+        if (cvar("g_balance_seeker_guided_proxy"))
+            self.movetype    = MOVETYPE_BOUNCEMISSILE;
+        else
+            self.movetype    = MOVETYPE_FLYMISSILE;
+
+    }
+}
+
+void Seeker_Fire_Missile(vector f_org)
+{
+    local entity missile;
+
+    if not(self.items & IT_UNLIMITED_AMMO)
+        self.ammo_rockets = self.ammo_rockets - cvar("g_balance_seeker_missile_ammo");
+
+    makevectors(self.v_angle);
+    W_SetupShot (self, f_org, FALSE, 2, "weapons/hagar_fire.ogg");
+    pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
+
+    //self.detornator         = FALSE;
+
+    missile                 = spawn();
+    missile.owner           = self;
+    missile.classname       = "seeker_missile";
+    missile.bot_dodge       = TRUE;
+    missile.bot_dodgerating = cvar("g_balance_seeker_missile_damage");
+
+    missile.think           = Seeker_Missile_Animate;
+
+    //if (!cvar("g_balance_seeker_missile_proxy"))
+    missile.touch           = Seeker_Missile_Touch;
+
+    missile.event_damage    = Seeker_Missile_Damage;
+    missile.nextthink       = time + 0.2;// + cvar("g_balance_seeker_missile_activate_delay");
+    missile.cnt             = time + cvar("g_balance_seeker_missile_lifetime");
+    missile.enemy           = self.enemy;
+    missile.switchweapon           = cvar("g_balance_seeker_missile_speed");
+    missile.effects         = EF_LOWPRECISION | EF_NOSHADOW;// | EF_ROCKET;
+    missile.solid           = SOLID_BBOX;
+    missile.scale           = 2;
+    missile.takedamage          = DAMAGE_YES;
+    missile.damageforcescale    = 4;
+    missile.health              = 5;
+
+    setorigin (missile, w_shotorg);
+    setmodel  (missile, "models/tagrocket.md3");
+    setsize (missile, '0 0 0', '0 0 0');
+
+
+    missile.movetype    = MOVETYPE_FLYMISSILE;// MOVETYPE_TOSS;
+
+    missile.flags       = FL_PROJECTILE;
+
+    missile.velocity    = (w_shotdir + '0 0 0.45') * missile.switchweapon;
+    W_SetupProjectileVelocity(missile);
+
+    missile.switchweapon = vlen(missile.velocity);
+    missile.angles = vectoangles (missile.velocity);
+
+}
+
+void Seeker_Vollycontroler_Think()
+{
+    entity oldself,oldenemy;
+    self.cnt = self.cnt - 1;
+    if ((self.owner.ammo_rockets < cvar("g_balance_seeker_missile_ammo")) || (self.cnt <= -1))
+    {
+        remove(self);
+        return;
+
+    }
+
+    self.nextthink = time + cvar("g_balance_seeker_missile_delay");
+
+    oldself = self;
+    self = self.owner;
+
+    oldenemy = self.enemy;
+    self.enemy = oldself.enemy;
+
+    switch(oldself.cnt)
+    {
+        case 0:
+            Seeker_Fire_Missile('37.5 17 -22');
+            break;
+        case 1:
+            Seeker_Fire_Missile('37.5 9.5 -22');
+            break;
+        case 2:
+            Seeker_Fire_Missile('40 17 -29');
+            break;
+        case 3:
+            Seeker_Fire_Missile('40 09.5 -29');
+            break;
+    }
+
+
+
+    self.enemy = oldenemy;
+    self = oldself;
+}
+
+void Seeker_Tag_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+    self.health = self.health - damage;
+    if (self.health <= 0)
+        self.think ();
+}
+
+void Seeker_Tag_Explode ()
+{
+    vector	org2;
+    float b;
+
+    //if(other==self.owner)
+    //    return;
+
+    org2 = findbetterlocation (self.origin, 12);
+    te_explosion (org2);
+
+    b = crandom();
+    if (b<-0.7)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp1.ogg", 1, ATTN_NORM);
+    else if (b<0.4)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp2.ogg", 1, ATTN_NORM);
+    else if (b<1)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp3.ogg", 1, ATTN_NORM);
+
+    remove (self);
+}
+
+void Seeker_Tag_Think()
+{
+    remove(self);
+    return;
+}
+
+void Seeker_Tag_Touch()
+{
+    vector dir;
+    vector org2;
+
+	if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
+	{
+		remove(self);
+		return;
+	}
+
+    if (other == self.owner)
+        return;
+
+    dir     = normalize (self.owner.origin - self.origin);
+    org2    = findbetterlocation (self.origin, 8);
+
+    te_knightspike(org2);
+
+    self.event_damage = SUB_Null;
+    sound (self, CHAN_PROJECTILE, "weapons/laserimpact.ogg", 1, ATTN_NORM);
+
+    if (other.classname == "player")
+    {
+
+        entity e;
+        e           = spawn();
+        e.cnt       = cvar("g_balance_seeker_missile_count");
+        e.owner     = self.owner;
+        e.enemy     = other;
+        e.think     = Seeker_Vollycontroler_Think;
+        e.nextthink = time;
+
+        //sprint(self.owner, "^1Target lock ^3[^7 ",other.netname, " ^3]^1 acquired - autofire activated.\n");
+        //sprint(other,"^1You are targeted!\n");
+
+        // stuffcmd(other,"play2 weapons/zany-alarm4.ogg\n");
+        // stuffcmd(self.owner, "play2 weapons/zany-lock4.ogg\n");
+    }
+
+    remove(self);
+    return;
+}
+
+
+
+void Seeker_Fire_Tag()
+{
+    local entity missile;
+    if (cvar("g_use_ammunition"))
+        self.ammo_rockets = self.ammo_rockets - cvar("g_balance_seeker_tag_ammo");
+
+    W_SetupShot (self, '56 13 -15', FALSE, 2, "weapons/hagar_fire.ogg");
+
+    missile                 = spawn();
+    missile.owner           = self;
+    missile.classname       = "seeker_tag";
+    missile.bot_dodge       = TRUE;
+    missile.bot_dodgerating = 50;
+    missile.touch           = Seeker_Tag_Touch;
+    missile.think           = Seeker_Tag_Think;
+    missile.nextthink       = time + 15;
+    missile.movetype        = MOVETYPE_FLY;
+    missile.solid           = SOLID_BBOX;
+    missile.owner           = self;
+
+    missile.takedamage       = DAMAGE_YES;
+    missile.event_damage    = Seeker_Tag_Explode;
+    missile.health          = 5;
+
+    setmodel (missile, "models/laser.mdl");
+    setorigin (missile, w_shotorg);
+
+    missile.effects     = EF_BRIGHTFIELD | EF_FULLBRIGHT | EF_NOSHADOW | EF_LOWPRECISION;
+    missile.flags       = FL_PROJECTILE;
+
+    missile.velocity    = w_shotdir  * cvar("g_balance_seeker_tag_speed");
+    missile.movetype    = MOVETYPE_BOUNCEMISSILE;
+    W_SetupProjectileVelocity(missile);
+    missile.angles = vectoangles (missile.velocity);
+}
+
+
+void Seeker_Flac_Explode ()
+{
+    vector	org2;
+    float b;
+    org2 = findbetterlocation (self.origin, 12);
+    te_explosion (org2);
+
+    b = crandom();
+    if (b<-0.7)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp1.ogg", 1, ATTN_NORM);
+    else if (b<0.4)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp2.ogg", 1, ATTN_NORM);
+    else if (b<1)
+        sound (self, CHAN_PROJECTILE, "weapons/hagexp3.ogg", 1, ATTN_NORM);
+
+    self.event_damage = SUB_Null;
+
+    RadiusDamage (self, self.owner, cvar("g_balance_seeker_flac_damage"), cvar("g_balance_seeker_flac_edgedamage"), cvar("g_balance_seeker_flac_radius"), world, cvar("g_balance_seeker_flac_force"), self.projectiledeathtype, other);
+
+    remove (self);
+}
+
+void Seeker_Flac_Touch()
+{
+    if (other == self.owner)
+        return;
+
+    Seeker_Flac_Explode();
+}
+
+void Seeker_Fire_Flac()
+{
+	local entity missile;
+    vector f_org;
+
+	if not(self.items & IT_UNLIMITED_AMMO)
+		self.ammo_rockets = self.ammo_rockets - cvar("g_balance_seeker_flac_ammo");
+
+    switch(floor(random() * 3))
+    {
+        case 0:
+            f_org = '37.5 17 -22';
+            break;
+        case 1:
+            f_org = '37.5 9.5 -22';
+            break;
+        case 2:
+            f_org = '40 17 -29';
+            break;
+        case 3:
+            f_org = '40 09.5 -29';
+            break;
+    }
+    W_SetupShot (self, f_org, FALSE, 2, "weapons/hagar_fire.wav");
+
+	pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
+
+	missile = spawn ();
+	missile.owner = missile.realowner = self;
+	missile.classname = "missile";
+	missile.bot_dodge = TRUE;
+	missile.bot_dodgerating = cvar("g_balance_seeker_flac_damage");
+	missile.touch = Seeker_Flac_Explode;
+	missile.use = Seeker_Flac_Explode;
+	missile.think = Seeker_Flac_Explode;
+	missile.nextthink = time + cvar("g_balance_seeker_flac_lifetime") + cvar("g_balance_seeker_flac_lifetime_rand");
+	missile.solid = SOLID_BBOX;
+	missile.scale = 0.4; // BUG: the model is too big
+	missile.projectiledeathtype = WEP_SEEKER;
+	setorigin (missile, w_shotorg);
+	setmodel (missile, "models/hagarmissile.mdl"); // precision set below
+	setsize (missile, '0 0 0', '0 0 0');
+
+	missile.effects = EF_LOWPRECISION;
+	missile.modelflags = MF_GRENADE;
+
+	missile.movetype = MOVETYPE_FLY;
+	w_shotdir = w_shotdir + '0 0 0.3';
+	missile.velocity    = (w_shotdir  + randomvec() * cvar("g_balance_seeker_flac_spread")) * cvar("g_balance_seeker_flac_speed");
+
+	W_SetupProjectileVelocity(missile);
+
+	missile.angles = vectoangles (missile.velocity);
+	missile.flags = FL_PROJECTILE;
+}
+
+void spawnfunc_weapon_seeker (void)
+{
+    weapon_defaultspawnfunc(WEP_SEEKER);
+}
+
+float w_seeker(float req)
+{
+    if (req == WR_AIM)
+        self.BUTTON_ATCK = bot_aim(cvar("g_balance_seeker_tag_speed"), 0, 20, FALSE);
+
+    else if (req == WR_THINK)
+    {
+        if (self.BUTTON_ATCK)
+            if (weapon_prepareattack(0, cvar("g_balance_seeker_tag_refire")))
+            {
+                Seeker_Fire_Tag();
+                weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_seeker_tag_animtime"), w_ready);
+            }
+
+        if (self.BUTTON_ATCK2)
+            if (weapon_prepareattack(1, cvar("g_balance_seeker_flac_refire")))
+            {
+                Seeker_Fire_Flac();
+                weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_seeker_flac_animtime"), w_ready);
+            }
+
+    }
+    else if (req == WR_PRECACHE)
+    {
+        precache_model ("models/tagrocket.md3");
+        precache_model ("models/weapons/g_seeker.md3");
+        precache_model ("models/weapons/v_seeker.md3");
+        precache_model ("models/weapons/w_seeker.zym");
+        precache_sound ("weapons/hagar_fire.wav");
+        precache_sound ("weapons/hagexp1.wav");
+        precache_sound ("weapons/hagexp2.wav");
+        precache_sound ("weapons/hagexp3.wav");
+    }
+    else if (req == WR_SETUP)
+        weapon_setup(WEP_SEEKER);
+    else if (req == WR_CHECKAMMO1)
+        return self.ammo_rockets >= cvar("g_balance_seeker_tag_ammo");
+    else if (req == WR_CHECKAMMO2)
+        return self.ammo_rockets >= cvar("g_balance_seeker_secondary_ammo");
+    else if (req == WR_SUICIDEMESSAGE)
+        w_deathtypestring = "played with tiny rockets";
+    else if (req == WR_KILLMESSAGE)
+            w_deathtypestring = "was taged by";
+    return TRUE;
+};
+

Added: trunk/data/textures/hlac.tga
===================================================================
(Binary files differ)


Property changes on: trunk/data/textures/hlac.tga
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/textures/seeker.tga
===================================================================
(Binary files differ)


Property changes on: trunk/data/textures/seeker.tga
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream




More information about the nexuiz-commits mailing list