r5289 - in trunk/data: . env env/mandelbrot gfx models/sprites models/weapons qcsrc/common qcsrc/server scripts sound/weapons textures

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Dec 23 17:24:47 EST 2008


Author: div0
Date: 2008-12-23 17:24:46 -0500 (Tue, 23 Dec 2008)
New Revision: 5289

Added:
   trunk/data/env/mandelbrot/
   trunk/data/env/mandelbrot/mandel_bk.jpg
   trunk/data/env/mandelbrot/mandel_dn.jpg
   trunk/data/env/mandelbrot/mandel_ft.jpg
   trunk/data/env/mandelbrot/mandel_lf.jpg
   trunk/data/env/mandelbrot/mandel_rt.jpg
   trunk/data/env/mandelbrot/mandel_up.jpg
   trunk/data/gfx/inv_weapon14.tga
   trunk/data/models/sprites/wpn-campingrifle_frame0.tga
   trunk/data/models/weapons/g_campingrifle.md3
   trunk/data/models/weapons/v_campingrifle.md3
   trunk/data/models/weapons/w_campingrifle.zym
   trunk/data/qcsrc/server/w_campingrifle.qc
   trunk/data/sound/weapons/campingrifle_fire.ogg
   trunk/data/sound/weapons/campingrifle_reload.ogg
   trunk/data/textures/campingrifle.tga
   trunk/data/textures/campingrifle_bump.tga
   trunk/data/textures/campingrifle_gloss.tga
   trunk/data/textures/campingrifle_glow.tga
   trunk/data/textures/campingrifle_pants.tga
   trunk/data/textures/campingrifle_shirt.tga
Modified:
   trunk/data/build-compat-pack.sh
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/common/items.qc
   trunk/data/qcsrc/common/items.qh
   trunk/data/qcsrc/server/havocbot.qc
   trunk/data/qcsrc/server/progs.src
   trunk/data/qcsrc/server/w_common.qc
   trunk/data/scripts/entities.def
   trunk/data/weapons.cfg
   trunk/data/weaponsPro.cfg
Log:
New stuff:

- Camping Rifle (with a preliminary model, should really be exchanged before release, and do not use it in maps yet)
- Ballistics mode (g_ballistics_force 1), makes Uzi and Shotgun bullets use the ballistics code from the camping rifle too so they are no longer hitscan (for SG this does not matter and is just less ugly, for MG it might actually fix its balance)
- A Mandelbrot set-based skybox made by the skybox generator I had posted
- Rocket launcher tuned to 120 damage units (before: 130)


Modified: trunk/data/build-compat-pack.sh
===================================================================
--- trunk/data/build-compat-pack.sh	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/build-compat-pack.sh	2008-12-23 22:24:46 UTC (rev 5289)
@@ -18,6 +18,7 @@
 	gfx/inv_weapon11.tga
 	gfx/inv_weapon12.tga
 	gfx/inv_weapon13.tga
+	gfx/inv_weapon14.tga
 	gfx/inv_weapon9.tga
 	gfx/reslimed_mini.tga
 	gfx/runningman_1on1remix_mini.tga
@@ -98,6 +99,7 @@
 	models/sprites/race-finish.tga
 	models/sprites/redbase.tga
 	models/sprites/waypoint.tga
+	models/sprites/wpn-campingrifle_frame0.tga
 	models/sprites/wpn-crylink_frame0.tga
 	models/sprites/wpn-electro_frame0.tga
 	models/sprites/wpn-gl_frame0.tga
@@ -149,16 +151,19 @@
 	models/turrets/walker_mghead.md3
 	models/turrets/walker_props.md3
 	models/turrets/walker_spawn.md3
+	models/weapons/g_campingrifle.md3
     models/weapons/g_hlac.md3
 	models/weapons/g_hookgun.md3
 	models/weapons/g_minstanex.md3
 	models/weapons/g_porto.md3
     models/weapons/g_seeker.md3
+	models/weapons/v_campingrifle.md3
     models/weapons/v_hlac.md3
 	models/weapons/v_hookgun.md3
 	models/weapons/v_minstanex.md3
 	models/weapons/v_porto.md3
     models/weapons/v_seeker.md3
+	models/weapons/w_campingrifle.zym
     models/weapons/w_hlac.zym
 	models/weapons/w_hookgun.zym
 	models/weapons/w_minstanex.zym
@@ -484,6 +489,8 @@
 	sound/weapons/brass1.ogg
 	sound/weapons/brass2.ogg
 	sound/weapons/brass3.ogg
+	sound/weapons/campingrifle_fire.ogg
+	sound/weapons/campingrifle_reload.ogg
 	sound/weapons/casings1.ogg
 	sound/weapons/casings2.ogg
 	sound/weapons/casings3.ogg
@@ -541,6 +548,12 @@
 	sound/weapons/uzi_fire.ogg
 	sound/weapons/weaponpickup.ogg
 	sound/weapons/weapon_switch.ogg
+	textures/campingrifle_bump.tga
+	textures/campingrifle_gloss.tga
+	textures/campingrifle_glow.tga
+	textures/campingrifle_pants.tga
+	textures/campingrifle_shirt.tga
+	textures/campingrifle.tga
 	textures/flags/flag_blue_cloth.tga
 	textures/flags/flag_blue_gloss.tga
 	textures/flags/flag_blue_glow.tga

Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/defaultNexuiz.cfg	2008-12-23 22:24:46 UTC (rev 5289)
@@ -1131,16 +1131,16 @@
 alias allready "sv_cmd allready"
 
 // note: these cvars use weapon NUMBERS. Use the menu to edit this cvar, or look the numbers up in qcsrc/common/constants.qh.
-seta cl_weaponpriority "14 13 9 8 11 7 6 5 4 3 2 1 10 12" // default porto and hook as LOW priority, use the weapon key numbers otherwise
+seta cl_weaponpriority "14 13 9 8 11 7 6 5 4 15 3 2 1 10 12" // default porto and hook as LOW priority, use the weapon key numbers otherwise
 seta cl_weaponpriority_useforcycling 0
 // impulse 200, 210, 220:
-seta cl_weaponpriority0 "14 9 8 4"   // explosives    (RL Hagar Mortar)
+seta cl_weaponpriority0 "14 9 8 4"    // explosives    (RL Hagar Mortar)
 // impulse 201, 211, 221:
-seta cl_weaponpriority1 "13 7 6 5 1" // energy        (Nex Crylink Electro Laser)
-seta cl_weaponpriority2 "7 3"        // hitscan exact (Nex MG)
-seta cl_weaponpriority3 "7 3 2"      // hitscan all   (Nex MG Shotgun)
-seta cl_weaponpriority4 "13 8 6 5 2" // spam          (Hagar Crylink Electro Shotgun)
-seta cl_weaponpriority5 "1 12 10"    // for moving    (Laser Hook Port-O-Launch)
+seta cl_weaponpriority1 "13 7 6 5 1"  // energy        (Nex Crylink Electro Laser)
+seta cl_weaponpriority2 "15 11 7 3"   // hitscan exact (Nex MG)
+seta cl_weaponpriority3 "15 11 7 3 2" // hitscan all   (Nex MG Shotgun)
+seta cl_weaponpriority4 "13 8 6 5 2"  // spam          (Hagar Crylink Electro Shotgun)
+seta cl_weaponpriority5 "1 12 10"     // for moving    (Laser Hook Port-O-Launch)
 seta cl_weaponpriority6 ""
 seta cl_weaponpriority7 ""
 seta cl_weaponpriority8 ""
@@ -1165,6 +1165,7 @@
 set g_weaponreplace_hook ""
 set g_weaponreplace_seeker ""
 set g_weaponreplace_hlac ""
+set g_weaponreplace_campingrifle ""
 
 seta sv_status_privacy 1 // hide IP addresses from "status" replies shown to clients
 
@@ -1245,3 +1246,8 @@
 set g_showweaponspawns 0 // 1: display sprites for weapon spawns found on the map when a weapon key is pressed and the weapon is not available
 
 alias records "cmd records"
+
+set g_ballistics_solidspeedhalflife 0.001 // note: bullets can travel this*velocity*1.44 far inside solid
+set g_ballistics_force 0 // 1: make all bullets use the ballistics code instead of hitscan
+set g_ballistics_force_uzi_speed 10000 // speed of uzi bullets if g_ballistics_force is 1
+set g_ballistics_force_shotgun_speed 6000 // speed of shotgun bullets if g_ballistics_force is 1

Added: trunk/data/env/mandelbrot/mandel_bk.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/data/env/mandelbrot/mandel_bk.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/env/mandelbrot/mandel_dn.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/data/env/mandelbrot/mandel_dn.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/env/mandelbrot/mandel_ft.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/data/env/mandelbrot/mandel_ft.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/env/mandelbrot/mandel_lf.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/data/env/mandelbrot/mandel_lf.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/env/mandelbrot/mandel_rt.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/data/env/mandelbrot/mandel_rt.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/env/mandelbrot/mandel_up.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/data/env/mandelbrot/mandel_up.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/gfx/inv_weapon14.tga
===================================================================
(Binary files differ)


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

Added: trunk/data/models/sprites/wpn-campingrifle_frame0.tga
===================================================================
(Binary files differ)


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

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


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

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


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

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


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

Modified: trunk/data/qcsrc/common/items.qc
===================================================================
--- trunk/data/qcsrc/common/items.qc	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/qcsrc/common/items.qc	2008-12-23 22:24:46 UTC (rev 5289)
@@ -112,6 +112,7 @@
 	register_weapon(WEP_HOOK,             w_hook,      IT_CELLS,       0, 0, 1,     0, "hookgun",   "hook",            "Grappling Hook");
 	register_weapon(WEP_SEEKER,           w_seeker,    IT_ROCKETS,     8, 1, 0,     0, "seeker",    "seeker",          "T.A.G. Seeker");
 	register_weapon(WEP_HLAC,             w_hlac,      IT_CELLS,       6, 1, 0,     0, "hlac",      "hlac",            "Heavy Laser Assault Cannon");
+	register_weapon(WEP_CAMPINGRIFLE,              w_campingrifle,       IT_NAILS,       3, 1, 0,  5000, "campingrifle",       "campingrifle",             "Camping Rifle");
 
 	register_weapons_done();
 }

Modified: trunk/data/qcsrc/common/items.qh
===================================================================
--- trunk/data/qcsrc/common/items.qh	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/qcsrc/common/items.qh	2008-12-23 22:24:46 UTC (rev 5289)
@@ -15,8 +15,9 @@
 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 WEP_CAMPINGRIFLE	    = 15; float WEPBIT_CAMPINGRIFLE     = 16384;
+float WEP_LAST				= 15; float WEPBIT_ALL              = 32767;
+float WEP_COUNT             = 16;
 
 float	IT_UNLIMITED_WEAPON_AMMO  = 1;
 // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.

Modified: trunk/data/qcsrc/server/havocbot.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot.qc	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/qcsrc/server/havocbot.qc	2008-12-23 22:24:46 UTC (rev 5289)
@@ -340,6 +340,7 @@
 	local float crylink ; crylink  =-1000;
 	local float uzi     ; uzi      =-1000;
 	local float shotgun ; shotgun  =-1000;
+	local float campingrifle ; campingrifle  =-1000;
 	local float laser   ; laser    =-1000;
 	local float minstanex ; minstanex =-1000;
 	local float currentscore;

Modified: trunk/data/qcsrc/server/progs.src
===================================================================
--- trunk/data/qcsrc/server/progs.src	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/qcsrc/server/progs.src	2008-12-23 22:24:46 UTC (rev 5289)
@@ -96,6 +96,7 @@
 w_hook.qc
 w_hlac.qc
 w_seeker.qc
+w_campingrifle.qc
 
 t_items.qc
 cl_weapons.qc

Added: trunk/data/qcsrc/server/w_campingrifle.qc
===================================================================
--- trunk/data/qcsrc/server/w_campingrifle.qc	                        (rev 0)
+++ trunk/data/qcsrc/server/w_campingrifle.qc	2008-12-23 22:24:46 UTC (rev 5289)
@@ -0,0 +1,154 @@
+//Camping rifle Primary mode: manually operated bolt*, Secondary: full automatic** --MikeeUSA--
+//* Manually operating the bolt means that all the power of the gas is used to propell the bullet. In this mode the bolt is prevented from moving backwards in response to the firing of the bullet.
+//** In fully automatic mode some of the gas is used to extract and reload the next cartrige, thus there is less power and range.
+
+.float campingrifle_bulletcounter;
+
+void W_Campingrifle_Reload()
+{
+	if (self.campingrifle_bulletcounter <= 0)
+		return;
+	
+	sound (self, CHAN_WEAPON2, "weapons/campingrifle_reload.wav", VOL_BASE, ATTN_NORM);
+	ATTACK_FINISHED(self) = time + cvar("g_balance_campingrifle_reloadtime");
+	self.campingrifle_bulletcounter = 0;
+}
+
+void W_Campingrifle_CheckReload()
+{
+	if (self.campingrifle_bulletcounter >= cvar("g_balance_campingrifle_magazinecapacity"))
+		W_Campingrifle_Reload();
+}
+
+void W_CampingRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAddedDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype)
+{
+	if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+		self.ammo_nails -= pAmmo;
+
+	W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/campingrifle_fire.wav");
+	pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 2000, 1);
+
+	fireBallisticBullet(w_shotorg, v_forward /* no TrueAim for this weapon */, pSpread, pSpeed, pLifetime, pDamage, pHeadshotAddedDamage / pDamage, pForce, deathtype, EF_RED, 1);
+	
+	self.campingrifle_bulletcounter = self.campingrifle_bulletcounter + 1;
+	W_Campingrifle_CheckReload();
+}
+
+void W_Campingrifle_Attack()
+{
+	W_CampingRifle_FireBullet(cvar("g_balance_campingrifle_primary_spread"), cvar("g_balance_campingrifle_primary_damage"), cvar("g_balance_campingrifle_primary_headshotaddeddamage"), cvar("g_balance_campingrifle_primary_force"), cvar("g_balance_campingrifle_primary_speed"), cvar("g_balance_campingrifle_primary_lifetime"), cvar("g_balance_campingrifle_primary_ammo"), WEP_CAMPINGRIFLE);
+}
+
+void W_Campingrifle_Attack2()
+{
+	W_CampingRifle_FireBullet(cvar("g_balance_campingrifle_secondary_spread"), cvar("g_balance_campingrifle_secondary_damage"), cvar("g_balance_campingrifle_secondary_headshotaddeddamage"), cvar("g_balance_campingrifle_secondary_force"), cvar("g_balance_campingrifle_secondary_speed"), cvar("g_balance_campingrifle_secondary_lifetime"), cvar("g_balance_campingrifle_secondary_ammo"), WEP_CAMPINGRIFLE | HITTYPE_SECONDARY);
+}
+
+void spawnfunc_weapon_campingrifle (void)
+{
+	weapon_defaultspawnfunc(WEP_CAMPINGRIFLE);
+}
+
+.float bot_secondary_campingriflemooth;
+float w_campingrifle(float req)
+{
+	if (req == WR_AIM)
+	{
+		self.BUTTON_ATCK=FALSE;
+		self.BUTTON_ATCK2=FALSE;
+		if(vlen(self.origin-self.enemy.origin) > 1000)
+			self.bot_secondary_campingriflemooth = 0;
+		if(self.bot_secondary_campingriflemooth == 0)
+		{
+			if(bot_aim(cvar("g_balance_campingrifle_primary_speed"), 0, cvar("g_balance_campingrifle_primary_lifetime"), TRUE))
+			{
+				self.BUTTON_ATCK = TRUE;
+				if(random() < 0.01) self.bot_secondary_campingriflemooth = 1;
+			}
+		}
+		else
+		{
+			if(bot_aim(cvar("g_balance_campingrifle_secondary_speed"), 0, cvar("g_balance_campingrifle_secondary_lifetime"), TRUE))
+			{
+				self.BUTTON_ATCK2 = TRUE;
+				if(random() < 0.03) self.bot_secondary_campingriflemooth = 0;
+			}
+		}
+	}
+	else if (req == WR_THINK)
+	{
+		if (self.BUTTON_ATCK)
+		if (weapon_prepareattack(0, cvar("g_balance_campingrifle_primary_refire")))
+		{
+			W_Campingrifle_Attack();
+			weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_campingrifle_primary_animtime"), w_ready);
+		}
+		if (self.BUTTON_ATCK2)
+		if (weapon_prepareattack(1, cvar("g_balance_campingrifle_secondary_refire")))
+		{
+			W_Campingrifle_Attack2();
+			weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_campingrifle_secondary_animtime"), w_ready);
+		}
+	}
+	else if (req == WR_PRECACHE)
+	{		
+		precache_model ("models/tracer.mdl");
+		precache_model ("models/weapons/g_campingrifle.md3");
+		precache_model ("models/weapons/v_campingrifle.md3");
+		precache_model ("models/weapons/w_campingrifle.zym");
+		precache_sound ("weapons/campingrifle_reload.wav");
+		precache_sound ("weapons/ric1.wav");
+		precache_sound ("weapons/ric2.wav");
+		precache_sound ("weapons/ric3.wav");
+		precache_sound ("weapons/campingrifle_fire.wav");
+		if (cvar("g_casings") >= 2)
+		{
+			precache_sound ("weapons/brass1.wav");
+			precache_sound ("weapons/brass2.wav");
+			precache_sound ("weapons/brass3.wav");
+			precache_model ("models/casing_bronze.mdl");
+		}
+	}
+	else if (req == WR_SETUP)
+	{
+		weapon_setup(WEP_CAMPINGRIFLE);
+		W_Campingrifle_Reload();
+	}
+	else if (req == WR_CHECKAMMO1)
+		return self.ammo_nails >= cvar("g_balance_campingrifle_primary_ammo");
+	else if (req == WR_CHECKAMMO2)
+		return self.ammo_nails >= cvar("g_balance_campingrifle_secondary_ammo");
+	else if (req == WR_SUICIDEMESSAGE)
+	{
+		if(w_deathtype & HITTYPE_SECONDARY)
+			w_deathtypestring = "shot himself automatically";
+		else
+			w_deathtypestring = "sniped himself somehow";
+	}
+	else if (req == WR_KILLMESSAGE)
+	{
+		if(w_deathtype & HITTYPE_SECONDARY)
+		{
+			if(w_deathtype & HITTYPE_BOUNCE)
+				w_deathtypestring = "failed to hide from #'s bullet hail";
+			else
+				w_deathtypestring = "died in #'s bullet hail";
+		}
+		else
+		{
+			if(w_deathtype & HITTYPE_BOUNCE)
+			{
+				// TODO special headshot message here too?
+				w_deathtypestring = "failed to hide from #'s rifle";
+			}
+			else
+			{
+				if(w_deathtype & HITTYPE_HEADSHOT)
+					w_deathtypestring = "got hit in the head by #";
+				else
+					w_deathtypestring = "was sniped by #";
+			}
+		}
+	}
+	return TRUE;
+};

Modified: trunk/data/qcsrc/server/w_common.qc
===================================================================
--- trunk/data/qcsrc/server/w_common.qc	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/qcsrc/server/w_common.qc	2008-12-23 22:24:46 UTC (rev 5289)
@@ -111,11 +111,238 @@
 	trace_dphitq3surfaceflags = endq3surfaceflags;
 }
 
+.float dmg_edge;
+.float dmg_force;
+.float dmg_radius;
+void W_BallisticBullet_Hit (void)
+{
+	vector org2;
+	float f;
+	org2 = self.origin - 6 * normalize(self.oldvelocity);
+
+	if (DEATH_ISWEAPON(self.projectiledeathtype, WEP_SHOTGUN))
+		pointparticles(particleeffectnum("shotgun_impact"), trace_endpos, trace_plane_normal * 1000, 1);
+	else
+		pointparticles(particleeffectnum("machinegun_impact"), trace_endpos, trace_plane_normal * 1000, 1);
+
+	if(other && other != self.enemy)
+	{
+		self.enemy = other; // don't hit the same player twice with the same bullet
+
+		f = vlen(self.velocity) / vlen(self.oldvelocity);
+
+		headshot = 0;
+		yoda = 0;
+		damage_headshotbonus = self.dmg_edge;
+		railgun_start = self.origin - 2 * frametime * self.oldvelocity;
+		railgun_end = self.origin + 2 * frametime * self.oldvelocity;
+		Damage(other, self, self.owner, self.dmg * f, self.projectiledeathtype, self.origin, self.dmg_force * normalize(self.velocity) * f);
+		damage_headshotbonus = 0;
+
+		if(self.dmg_edge != 0)
+		{
+			if(headshot)
+				announce(self.owner, "announcer/male/headshot.wav");
+			if(yoda)
+				announce(self.owner, "announcer/male/yoda.wav");
+		}
+
+		//sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
+	}
+}
+
+.void(void) leave_solid_think_save;
+.float leave_solid_nextthink_save;
+.vector leave_solid_origin;
+.vector leave_solid_velocity;
+
+void leave_solid_think()
+{
+	setorigin(self, self.leave_solid_origin);
+	self.velocity = self.leave_solid_velocity;
+
+	self.think = self.leave_solid_think_save;
+	self.nextthink = max(time, self.leave_solid_nextthink_save) + 1;
+	self.leave_solid_think_save = SUB_Null;
+
+	self.flags &~= FL_ONGROUND;
+	self.effects &~= EF_NODRAW;
+}
+
+// a fake logarithm function
+float log(float x)
+{
+	if(x < 0.0001)
+		return 0;
+	if(x > 0.9 && x < 1.1)
+		return x - 1;
+	return 2 * log(sqrt(x));
+}
+
+float leave_solid(entity e, vector vel, float speedhalflife)
+{
+	// move the entity along its velocity until it's out of solid, then let it resume
+	
+	vector tracevel, org, skiporg, endorg, t;
+	float dt, dst, velfactor, v0;
+	float maxdist;
+
+	speedhalflife *= 1.442695040888963; // distance for 1/eth of the speed
+	v0 = vlen(vel);
+
+	// maxdist: max distance that CAN be travelled using current velocity and speed halflife
+	//
+	// v(t) = v(0) * e^(-t / speedhalflife)
+	// integrate
+	// V(t) = - v(0) * e^(-t / speedhalflife) * speedhalflife
+	// s(t) = V(t) - V(0)
+	// s(t) = (speedhalflife * v(0)) * (1 - e^(-t / speedhalflife))
+	// lim s = speedhalflife * v(0)
+	// t(s) = speedhalflife * log((speedhalflife * v(0)) / (speedhalflife * v(0) - s))
+	// v(s) = (speedhalflife * v(0) - s) / speedhalflife
+
+	maxdist = speedhalflife * v0;
+	//print("max dist = ", ftos(maxdist), "\n");
+
+	if(maxdist <= 0)
+		return 0;
+
+	tracevel = normalize(vel);
+
+	org = self.origin;
+	skiporg = org + tracevel;
+	endorg = org + tracevel * maxdist;
+
+	for(;;)
+	{
+		traceline(skiporg, endorg, MOVE_NORMAL, self);
+		t = trace_endpos;
+
+		if(trace_startsolid)
+		{
+			// good: skiporg is actually in solid
+			traceline(t, skiporg, MOVE_NORMAL, self);
+			t = trace_endpos;
+
+			if(trace_startsolid)
+			{
+				// we're stuck inside solid :(
+				// force advance by 1 unit, and retry
+				// CAN we go by 1 unit?
+				if(vlen(skiporg + tracevel - org) < maxdist)
+					skiporg = skiporg + tracevel;
+				else
+					return 0;
+			}
+			else
+			{
+				// we managed to leave solid
+				// so trace_endpos is good
+				self.leave_solid_origin = t;
+				break;
+			}
+		}
+		else
+		{
+			// bad: skiporg is outside solid. Then imagine it's alright.
+			self.leave_solid_origin = skiporg;
+			break;
+		}
+	}
+
+	dst = vlen(self.leave_solid_origin - org);
+	velfactor = (speedhalflife * v0 - dst) / (speedhalflife * v0);
+
+	// t(s) = speedhalflife * log((speedhalflife * v(0)) / (speedhalflife * v(0) - s))
+	dt = speedhalflife * log((speedhalflife * v0) / (speedhalflife * v0 - dst));
+
+	//print("slowdown by ", ftos(dst), " units = ", ftos(velfactor), "\n");
+	//print("takes time ", ftos(dt), "\n");
+
+	self.leave_solid_think_save = self.think;
+	self.leave_solid_nextthink_save = self.nextthink;
+	self.think = leave_solid_think;
+	self.nextthink = time + dt;
+
+	vel = vel * velfactor;
+
+	self.velocity = '0 0 0';
+	self.flags |= FL_ONGROUND; // prevent moving
+	self.effects |= EF_NODRAW;
+	self.leave_solid_velocity = vel;
+
+	return 1;
+}
+
+void W_BallisticBullet_Touch (void)
+{
+	if(self.think == leave_solid_think) // skip this!
+		return;
+
+	PROJECTILE_TOUCH;
+	W_BallisticBullet_Hit ();
+
+	// go through solid!
+	if(!leave_solid(self, self.velocity, self.dmg_radius))
+	{
+		remove(self);
+		return;
+	}
+
+	self.projectiledeathtype |= HITTYPE_BOUNCE;
+}
+
+void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float headshotbonus, float force, float dtype, float tracereffects, float gravityfactor)
+{
+	entity proj;
+	proj = spawn();
+	proj.owner = self;
+	proj.solid = SOLID_BBOX;
+	if(gravityfactor > 0)
+	{
+		proj.movetype = MOVETYPE_TOSS;
+		proj.gravity = gravityfactor;
+	}
+	else
+		proj.movetype = MOVETYPE_FLY;
+	proj.think = SUB_Remove;
+	proj.nextthink = time + lifetime; // min(pLifetime, vlen(world.maxs - world.mins) / pSpeed);
+	proj.velocity = (dir + randomvec() * spread) * pSpeed;
+	W_SetupProjectileVelocity(proj);
+	proj.angles = vectoangles(proj.velocity);
+	proj.dmg_radius = cvar("g_ballistics_solidspeedhalflife");
+	setmodel(proj, "models/tracer.mdl");
+	setsize(proj, '0 0 0', '0 0 0');
+	setorigin(proj, w_shotorg);
+	proj.effects = EF_LOWPRECISION | tracereffects;
+	proj.flags = FL_PROJECTILE;
+
+	proj.touch = W_BallisticBullet_Touch;
+	proj.dmg = damage;
+	proj.dmg_edge = headshotbonus;
+	proj.dmg_force = force;
+	proj.projectiledeathtype = dtype;
+
+	proj.oldvelocity = proj.velocity;
+
+	if (cvar("g_casings") >= 2)
+		SpawnCasing (w_shotorg + v_forward * 10, ((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3);
+}
+
 void fireBullet (vector start, vector dir, float spread, float damage, float force, float dtype, float tracer)
 {
 	vector  end;
 	local entity e;
 
+	if(cvar("g_ballistics_force"))
+	{
+		if (DEATH_ISWEAPON(dtype, WEP_SHOTGUN))
+			fireBallisticBullet(start, dir, spread, cvar("g_ballistics_force_shotgun_speed"), 5, damage, 0, force, dtype, 0, 1);
+		else
+			fireBallisticBullet(start, dir, spread, cvar("g_ballistics_force_uzi_speed"), 5, damage, 0, force, dtype, 0, 1);
+		return;
+	}
+
 	dir = dir + randomvec() * spread;
 	end = start + dir * MAX_SHOT_DISTANCE;
 	if(self.antilag_debug)

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/scripts/entities.def	2008-12-23 22:24:46 UTC (rev 5289)
@@ -1216,6 +1216,7 @@
 /*QUAKED weapon_hlac (1 0 .5) (-30 -30 0) (30 30 32) FLOATING
 the Heavy Laser Assault Cannon.
 -------- KEYS --------
+ammo_cells: initial cells of the weapon (if unset, g_pickup_cells is used)
 respawntime: time till it respawns (default: 30)
 team: out of items with the same value here, only one (random one) will spawn. Useful to put multiple items on one spot.
 cnt: weight of this item for random selection using "team". Set to a lower value for items you want to see less likely.
@@ -1228,6 +1229,7 @@
 /*QUAKED weapon_seeker (1 0 .5) (-30 -30 0) (30 30 32) FLOATING
 the T.A.G. Seeker.
 -------- KEYS --------
+ammo_rockets: initial rockets of the weapon (if unset, g_pickup_rockets is used)
 respawntime: time till it respawns (default: 30)
 team: out of items with the same value here, only one (random one) will spawn. Useful to put multiple items on one spot.
 cnt: weight of this item for random selection using "team". Set to a lower value for items you want to see less likely.
@@ -1240,6 +1242,7 @@
 /*QUAKED weapon_hook (1 0 .5) (-30 -30 0) (30 30 32) FLOATING
 the on-hand Grappling Hook.
 -------- KEYS --------
+ammo_cells: initial cells of the weapon (if unset, g_pickup_cells is used)
 respawntime: time till it respawns (default: 30)
 team: out of items with the same value here, only one (random one) will spawn. Useful to put multiple items on one spot.
 cnt: weight of this item for random selection using "team". Set to a lower value for items you want to see less likely.
@@ -1256,3 +1259,19 @@
 max_health: max health this trigger will give (default 200)
 noise: sound file to play (use misc/null.wav to make it silent), default = item_health_medium sound
 */
+
+/*QUAKED weapon_campingrifle (1 0 .5) (-30 -30 0) (30 30 32) FLOATING
+the Camping Rifle.
+WARNING: DO NOT PLACE THIS ON MAPS YET.
+The weapon is subject to change in behaviour and appearance, and such a change may break weapon balance on your map. So don't place it yet, use it as server weapon replacement option ONLY.
+-------- KEYS --------
+ammo_nails: initial bullets of the weapon (if unset, g_pickup_nails is used)
+respawntime: time till it respawns (default: 30)
+team: out of items with the same value here, only one (random one) will spawn. Useful to put multiple items on one spot.
+cnt: weight of this item for random selection using "team". Set to a lower value for items you want to see less likely.
+-------- SPAWNFLAGS --------
+FLOATING: the item will float in air, instead of aligning to the floor by falling
+-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
+model="models/weapons/g_campingrifle.md3"
+*/
+

Added: trunk/data/sound/weapons/campingrifle_fire.ogg
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/weapons/campingrifle_fire.ogg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/sound/weapons/campingrifle_reload.ogg
===================================================================
(Binary files differ)


Property changes on: trunk/data/sound/weapons/campingrifle_reload.ogg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

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


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

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


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

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


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

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


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

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


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

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


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

Modified: trunk/data/weapons.cfg
===================================================================
--- trunk/data/weapons.cfg	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/weapons.cfg	2008-12-23 22:24:46 UTC (rev 5289)
@@ -19,6 +19,7 @@
 set g_start_weapon_hook 0
 set g_start_weapon_hlac 0
 set g_start_weapon_seeker 0
+set g_start_weapon_campingrifle 0
 set g_start_ammo_shells 50
 set g_start_ammo_nails 0
 set g_start_ammo_rockets 0
@@ -212,7 +213,7 @@
 set g_balance_hagar_secondary_refire 0.15
 set g_balance_hagar_secondary_ammo 1
 
-set g_balance_rocketlauncher_damage 130
+set g_balance_rocketlauncher_damage 120
 set g_balance_rocketlauncher_edgedamage 35
 set g_balance_rocketlauncher_force 600
 set g_balance_rocketlauncher_radius 150
@@ -342,4 +343,25 @@
 set g_balance_seeker_flac_animtime     0.1
 set g_balance_seeker_flac_ammo         0.5
 
-
+// NOTE: maps should not use this weapon yet
+set g_balance_campingrifle_magazinecapacity 12
+set g_balance_campingrifle_reloadtime 1.4
+set g_balance_campingrifle_primary_damage 90
+set g_balance_campingrifle_primary_headshotaddeddamage 160
+set g_balance_campingrifle_primary_spread 0
+set g_balance_campingrifle_primary_force 2
+set g_balance_campingrifle_primary_speed 40000
+set g_balance_campingrifle_primary_lifetime 5
+set g_balance_campingrifle_primary_refire 0.7
+set g_balance_campingrifle_primary_animtime 0.3
+set g_balance_campingrifle_primary_ammo 10
+set g_balance_campingrifle_secondary_damage 60
+set g_balance_campingrifle_secondary_headshotaddeddamage 0
+set g_balance_campingrifle_secondary_spread 0.02
+set g_balance_campingrifle_secondary_force 1
+set g_balance_campingrifle_secondary_speed 8000
+set g_balance_campingrifle_secondary_lifetime 5
+set g_balance_campingrifle_secondary_refire 0.12
+set g_balance_campingrifle_secondary_animtime 0.06
+set g_balance_campingrifle_secondary_ammo 10
+set g_balance_campingrifle_secondary_health 5

Modified: trunk/data/weaponsPro.cfg
===================================================================
--- trunk/data/weaponsPro.cfg	2008-12-23 10:26:15 UTC (rev 5288)
+++ trunk/data/weaponsPro.cfg	2008-12-23 22:24:46 UTC (rev 5289)
@@ -337,4 +337,25 @@
 set g_balance_seeker_flac_animtime     0.1
 set g_balance_seeker_flac_ammo         0.5
 
-
+// NOTE: maps should not use this weapon yet
+set g_balance_campingrifle_magazinecapacity 12
+set g_balance_campingrifle_reloadtime 1.4
+set g_balance_campingrifle_primary_damage 90
+set g_balance_campingrifle_primary_headshotaddeddamage 160
+set g_balance_campingrifle_primary_spread 0
+set g_balance_campingrifle_primary_force 2
+set g_balance_campingrifle_primary_speed 40000
+set g_balance_campingrifle_primary_lifetime 5
+set g_balance_campingrifle_primary_refire 0.7
+set g_balance_campingrifle_primary_animtime 0.3
+set g_balance_campingrifle_primary_ammo 10
+set g_balance_campingrifle_secondary_damage 60
+set g_balance_campingrifle_secondary_headshotaddeddamage 0
+set g_balance_campingrifle_secondary_spread 0.02
+set g_balance_campingrifle_secondary_force 1
+set g_balance_campingrifle_secondary_speed 8000
+set g_balance_campingrifle_secondary_lifetime 5
+set g_balance_campingrifle_secondary_refire 0.12
+set g_balance_campingrifle_secondary_animtime 0.06
+set g_balance_campingrifle_secondary_ammo 10
+set g_balance_campingrifle_secondary_health 5




More information about the nexuiz-commits mailing list