r4790 - in trunk/data: . qcsrc/common qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Oct 21 02:20:01 EDT 2008


Author: div0
Date: 2008-10-21 02:20:01 -0400 (Tue, 21 Oct 2008)
New Revision: 4790

Added:
   trunk/data/qcsrc/server/w_hook.qc
Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/effectinfo.txt
   trunk/data/keybinds.txt
   trunk/data/qcsrc/common/constants.qh
   trunk/data/qcsrc/server/cl_weapons.qc
   trunk/data/qcsrc/server/g_hook.qc
   trunk/data/qcsrc/server/g_hook.qh
   trunk/data/qcsrc/server/progs.src
   trunk/data/weapons.cfg
Log:
add on-hand hook weapon placable by mapper (weapon_hook)


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-10-20 13:27:34 UTC (rev 4789)
+++ trunk/data/defaultNexuiz.cfg	2008-10-21 06:20:01 UTC (rev 4790)
@@ -1111,7 +1111,7 @@
 
 alias allready "sv_cmd allready"
 
-seta cl_weaponpriority "10 9 8 11 7 6 5 4 3 2 1"
+seta cl_weaponpriority "10 9 8 11 7 6 5 4 3 2 1 12"
 seta cl_weaponpriority_useforcycling 0
 // impulse 200, 210, 220:
 seta cl_weaponpriority0 "9 8 4"      // explosives    (RL Hagar Mortar)
@@ -1142,6 +1142,7 @@
 set g_weaponreplace_9 ""
 set g_weaponreplace_10 ""
 set g_weaponreplace_11 ""
+set g_weaponreplace_12 ""
 
 seta sv_status_privacy 1 // hide IP addresses from "status" replies shown to clients
 

Modified: trunk/data/effectinfo.txt
===================================================================
--- trunk/data/effectinfo.txt	2008-10-20 13:27:34 UTC (rev 4789)
+++ trunk/data/effectinfo.txt	2008-10-21 06:20:01 UTC (rev 4790)
@@ -2546,3 +2546,60 @@
 velocityjitter 81 81 150
 color 0x7cbaff 0xcfd1ff
 velocitymultiplier 2
+
+
+
+// decal
+effect hookbomb_explode
+countabsolute 1
+type decal
+tex 8 16
+size 96 96
+alpha 256 256 0
+originjitter 40 40 40
+lightradius 1600
+lightradiusfade 800
+lightcolor 1 4 8
+// fire effect which make brigt dot inside
+effect hookbomb_explode
+notunderwater
+count 100
+type static
+tex 48 55
+color 0x003fe0 0x92dfff
+size 12 32
+sizeincrease 80
+alpha 512 328 756
+bounce 1
+airfriction 8
+liquidfriction 8
+originjitter 8 8 8
+velocityjitter 1024 1024 1024
+// smoke
+effect hookbomb_explode
+type alphastatic
+notunderwater
+tex 0 8
+count 160
+size 80 160
+sizeincrease 300
+alpha 500 600 556
+velocityoffset 0 0 0
+velocityjitter 256 256 256
+airfriction 0
+color 0x000000 0x111111
+bounce 6
+// underwater bubbles
+effect hookbomb_explode
+underwater
+count 60
+type bubble
+tex 62 62
+color 0x404040 0x808080
+size 3 3
+alpha 128 256 64
+gravity -0.125
+bounce 1.5
+liquidfriction 0.0625
+originjitter 16 16 16
+velocityjitter 192 192 192

Modified: trunk/data/keybinds.txt
===================================================================
--- trunk/data/keybinds.txt	2008-10-20 13:27:34 UTC (rev 4789)
+++ trunk/data/keybinds.txt	2008-10-21 06:20:01 UTC (rev 4790)
@@ -5,7 +5,7 @@
 "+moveright"                            "strafe right"
 "+jump"                                 "jump / swim"
 "+crouch"                               "crouch / sink"
-"+hook"                                 "grappling hook"
+"+hook"                                 "off-hand hook"
 ""                                      ""
 ""                                      "Attacking"
 "+attack"                               "primary fire"

Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh	2008-10-20 13:27:34 UTC (rev 4789)
+++ trunk/data/qcsrc/common/constants.qh	2008-10-21 06:20:01 UTC (rev 4790)
@@ -309,8 +309,9 @@
 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_LAST				= 11; float WEPBIT_ALL              = 2047;
-float WEP_COUNT             = 12;
+float WEP_HOOK     			= 12; float WEPBIT_HOOK     		= 2048;
+float WEP_LAST				= 12; float WEPBIT_ALL              = 4095;
+float WEP_COUNT             = 13;
 
 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-20 13:27:34 UTC (rev 4789)
+++ trunk/data/qcsrc/server/cl_weapons.qc	2008-10-21 06:20:01 UTC (rev 4790)
@@ -451,5 +451,6 @@
 	register_weapon(WEP_ROCKET_LAUNCHER,  w_rlauncher, IT_ROCKETS,     9, 1, 10000, "rl",        "rocketlauncher",  "Rocket Launcher");
 	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, "hook",      "hook",            "Grappling Hook");
 	register_weapons_done();
 }

Modified: trunk/data/qcsrc/server/g_hook.qc
===================================================================
--- trunk/data/qcsrc/server/g_hook.qc	2008-10-20 13:27:34 UTC (rev 4789)
+++ trunk/data/qcsrc/server/g_hook.qc	2008-10-21 06:20:01 UTC (rev 4790)
@@ -387,10 +387,10 @@
 		// offhand hook controls
 		if(self.BUTTON_HOOK)
 		{
-			if not(self.hook || (self.hook_state & HOOK_WAITING_FOR_REFIRE))
+			if not(self.hook || (self.hook_state & HOOK_WAITING_FOR_RELEASE))
 			{
 				self.hook_state |= HOOK_FIRING;
-				self.hook_state |= HOOK_WAITING_FOR_REFIRE;
+				self.hook_state |= HOOK_WAITING_FOR_RELEASE;
 			}
 		}
 		else
@@ -398,7 +398,7 @@
 			if(self.hook)
 			{
 				self.hook_state |= HOOK_REMOVING;
-				self.hook_state (-) HOOK_WAITING_FOR_REFIRE;
+				self.hook_state (-) HOOK_WAITING_FOR_RELEASE;
 			}
 		}
 
@@ -415,6 +415,12 @@
 		}
 	}
 
+	if(!g_grappling_hook && self.weapon != WEP_HOOK)
+	{
+		self.hook_state (-) HOOK_FIRING;
+		self.hook_state |= HOOK_REMOVING;
+	}
+
 	if (self.hook_state & HOOK_FIRING)
 	{
 		if (self.hook)

Modified: trunk/data/qcsrc/server/g_hook.qh
===================================================================
--- trunk/data/qcsrc/server/g_hook.qh	2008-10-20 13:27:34 UTC (rev 4789)
+++ trunk/data/qcsrc/server/g_hook.qh	2008-10-21 06:20:01 UTC (rev 4790)
@@ -10,5 +10,5 @@
 float HOOK_REMOVING = 2;
 float HOOK_PULLING = 4;
 float HOOK_RELEASING = 8;
-float HOOK_WAITING_FOR_REFIRE = 16;
+float HOOK_WAITING_FOR_RELEASE = 16;
 .float hook_state;

Modified: trunk/data/qcsrc/server/progs.src
===================================================================
--- trunk/data/qcsrc/server/progs.src	2008-10-20 13:27:34 UTC (rev 4789)
+++ trunk/data/qcsrc/server/progs.src	2008-10-21 06:20:01 UTC (rev 4790)
@@ -83,6 +83,7 @@
 w_hagar.qc
 w_rocketlauncher.qc
 w_porto.qc
+w_hook.qc
 
 t_items.qc
 cl_weapons.qc

Added: trunk/data/qcsrc/server/w_hook.qc
===================================================================
--- trunk/data/qcsrc/server/w_hook.qc	                        (rev 0)
+++ trunk/data/qcsrc/server/w_hook.qc	2008-10-21 06:20:01 UTC (rev 4790)
@@ -0,0 +1,147 @@
+void W_Hook_Explode2 (void)
+{
+	vector org2;
+
+	org2 = findbetterlocation (self.origin, 12);
+	pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1);
+	sound (self, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM);
+
+	self.event_damage = SUB_Null;
+	RadiusDamage (self, self.owner, cvar("g_balance_hook_secondary_damage"), cvar("g_balance_hook_secondary_edgedamage"), cvar("g_balance_hook_secondary_radius"), world, cvar("g_balance_hook_secondary_force"), self.projectiledeathtype, other);
+
+	remove(self);
+}
+
+void W_Hook_Touch2 (void)
+{
+	if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
+	{
+		remove(self);
+		return;
+	}
+	self.use();
+}
+
+void W_Hook_Attack2()
+{
+	local entity gren;
+
+	if not(self.items & IT_UNLIMITED_AMMO)
+		self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_secondary_ammo");
+	W_SetupShot (self, '25 6 -8', FALSE, 4, "weapons/hookbomb_fire.wav");
+
+	gren = spawn ();
+	gren.owner = self;
+	gren.classname = "hookbomb";
+	gren.bot_dodge = TRUE;
+	gren.bot_dodgerating = cvar("g_balance_hook_secondary_damage");
+	gren.movetype = MOVETYPE_TOSS;
+	gren.solid = SOLID_BBOX;
+	gren.effects = EF_LOWPRECISION;
+	gren.modelflags = MF_TRACER2;
+	gren.projectiledeathtype = WEP_HOOK | HITTYPE_SECONDARY;
+	setmodel(gren, "models/grenademodel.md3"); // precision set above // FIXME replace
+	setsize(gren, '0 0 0', '0 0 0');
+	setorigin(gren, w_shotorg);
+
+	gren.nextthink = time + cvar("g_balance_hook_secondary_lifetime");
+	gren.think = adaptor_think2use;
+	gren.use = W_Hook_Explode2;
+	gren.touch = W_Hook_Touch2;
+	gren.velocity = '0 0 1' * cvar("g_balance_hook_secondary_speed");
+	gren.gravity = cvar("g_balance_hook_secondary_gravity");
+	//W_SetupProjectileVelocity(gren); // just falling down!
+
+	gren.angles = '0 0 0';
+	gren.flags = FL_PROJECTILE;
+}
+
+void spawnfunc_weapon_hook (void)
+{
+	weapon_defaultspawnfunc(WEP_HOOK);
+}
+
+float w_hook(float req)
+{
+	if (req == WR_AIM)
+	{
+		// ... sorry ...
+	}
+	else if (req == WR_THINK)
+	{
+		if (self.BUTTON_ATCK || self.BUTTON_HOOK)
+		{
+			if(!self.hook)
+			if not(self.hook_state & HOOK_WAITING_FOR_RELEASE)
+			if (weapon_prepareattack(0, cvar("g_balance_hook_primary_refire")))
+			{
+				if not(self.items & IT_UNLIMITED_AMMO)
+					self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_primary_ammo");
+				self.hook_state |= HOOK_FIRING;
+				weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hook_primary_animtime"), w_ready);
+			}
+		}
+
+		if (self.BUTTON_ATCK2)
+		{
+			if (weapon_prepareattack(1, cvar("g_balance_hook_secondary_refire")))
+			{
+				W_Hook_Attack2();
+				weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hook_secondary_animtime"), w_ready);
+			}
+		}
+
+		if (self.BUTTON_CROUCH)
+		{
+			self.hook_state (-) HOOK_PULLING;
+			if (self.BUTTON_ATCK || self.BUTTON_HOOK)
+				self.hook_state (-) HOOK_RELEASING;
+			else
+				self.hook_state |= HOOK_RELEASING;
+		}
+		else
+		{
+			self.hook_state |= HOOK_PULLING;
+			self.hook_state (-) HOOK_RELEASING;
+
+			if (self.BUTTON_ATCK || self.BUTTON_HOOK)
+			{
+				// already fired
+				if(self.hook)
+					self.hook_state |= HOOK_WAITING_FOR_RELEASE;
+			}
+			else
+			{
+				self.hook_state |= HOOK_REMOVING;
+				self.hook_state (-) HOOK_WAITING_FOR_RELEASE;
+			}
+		}
+	}
+	else if (req == WR_PRECACHE)
+	{
+		precache_model ("models/weapons/g_hook.md3");
+		precache_model ("models/weapons/v_hook.md3");
+		precache_model ("models/weapons/w_hook.zym");
+		precache_sound ("weapons/hook_fire.wav");
+		precache_sound ("weapons/hook_impact.wav");
+		precache_sound ("weapons/hookbomb_fire.wav");
+		precache_sound ("weapons/hookbomb_impact.wav");
+	}
+	else if (req == WR_SETUP)
+	{
+		weapon_setup(WEP_HOOK);
+	}
+	else if (req == WR_CHECKAMMO1)
+	{
+		return self.ammo_cells >= cvar("g_balance_hook_primary_ammo");
+	}
+	else if (req == WR_CHECKAMMO2)
+	{
+		return self.ammo_cells >= cvar("g_balance_hook_secondary_ammo");
+	}
+	else if (req == WR_SUICIDEMESSAGE)
+		w_deathtypestring = "did the impossible";
+	else if (req == WR_KILLMESSAGE)
+		w_deathtypestring = "has run into #'s gravity bomb";
+	return TRUE;
+};

Modified: trunk/data/weapons.cfg
===================================================================
--- trunk/data/weapons.cfg	2008-10-20 13:27:34 UTC (rev 4789)
+++ trunk/data/weapons.cfg	2008-10-21 06:20:01 UTC (rev 4790)
@@ -9,6 +9,7 @@
 set g_start_weapon_rocketlauncher 0
 set g_start_weapon_minstanex 0
 set g_start_weapon_porto 0
+set g_start_weapon_hook 0
 set g_start_ammo_shells 50
 set g_start_ammo_nails 0
 set g_start_ammo_rockets 0
@@ -225,3 +226,18 @@
 set g_balance_porto_primary_ammo 25
 set g_balance_portal_health 200 // these get recharged whenever the portal is used
 set g_balance_portal_lifetime 15 // these get recharged whenever the portal is used
+
+// TESTING: on-hand hook with bomb
+set g_balance_hook_primary_ammo 0 // hook monkeys
+set g_balance_hook_primary_refire 0 // hook monkeys
+set g_balance_hook_primary_animtime 0.3 // good shoot anim
+set g_balance_hook_secondary_damage 25 // not much
+set g_balance_hook_secondary_edgedamage 5 // not much
+set g_balance_hook_secondary_radius 800 // LOTS
+set g_balance_hook_secondary_force -2000 // LOTS
+set g_balance_hook_secondary_ammo 25 // a whole pack
+set g_balance_hook_secondary_lifetime 30 // infinite
+set g_balance_hook_secondary_speed 200 // throw it a bit upwards
+set g_balance_hook_secondary_gravity 0.3 // matrix
+set g_balance_hook_secondary_refire 3 // don't drop too many bombs...
+set g_balance_hook_secondary_animtime 0.3 // good shoot anim




More information about the nexuiz-commits mailing list