File:  [Quake II] / quake2 / game / x
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:59:04 2018 UTC (8 years, 3 months ago) by root
Branches: iD, MAIN
CVS tags: quake2_317, HEAD
Quake II v3.17

--- p_weapon.c	Wed Apr 01 20:36:39 1998
+++ e:\Incoming\p_weapon.c	Tue Apr 07 11:16:41 1998
@@ -11,7 +11,7 @@
 void weapon_grenade_fire (edict_t *ent, qboolean held);
 
 
-static void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
+void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
 {
 	vec3_t	_distance;
 
@@ -152,10 +152,28 @@
 current
 ===============
 */
-void ChangeWeapon (edict_t *ent)
+
+// ### Hentai ### BEGIN
+void ShowGun(edict_t *ent)
 {
-	int i;
+	char heldmodel[128];
+	if(!ent->client->pers.weapon)
+	{
+		ent->s.modelindex2 = 0;
+		return;
+	}
+
+	strcpy(heldmodel, "*"); // Zoid: is this a * or a #?
+	strcat(heldmodel, ent->client->pers.weapon->icon);	
+	strcat(heldmodel, ".md2");
+	//gi.dprintf ("%s\n", heldmodel);
+	ent->s.modelindex2 = gi.modelindex(heldmodel);	// Hentai's custom gun models
+
+}
+// ### Hentai ### END
 
+void ChangeWeapon (edict_t *ent)
+{
 	if (ent->client->grenade_time)
 	{
 		ent->client->grenade_time = level.time;
@@ -169,22 +187,13 @@
 	ent->client->newweapon = NULL;
 	ent->client->machinegun_shots = 0;
 
-	// set visible model
-	if (ent->s.modelindex == 255) {
-		if (ent->client->pers.weapon)
-			i = ((ent->client->pers.weapon->weapmodel & 0xff) << 8);
-		else
-			i = 0;
-		ent->s.skinnum = (ent - g_edicts - 1) | i;
-	}
-
 	if (ent->client->pers.weapon && ent->client->pers.weapon->ammo)
 		ent->client->ammo_index = ITEM_INDEX(FindItem(ent->client->pers.weapon->ammo));
 	else
 		ent->client->ammo_index = 0;
 
-	if (!ent->client->pers.weapon)
-	{	// dead
+	if (!ent->client->pers.weapon || ent->s.modelindex != 255) // ### Hentai ### 
+	{	// dead, or not on client, so VWep animations could do wacky things
 		ent->client->ps.gunindex = 0;
 		return;
 	}
@@ -193,6 +202,7 @@
 	ent->client->ps.gunframe = 0;
 	ent->client->ps.gunindex = gi.modelindex(ent->client->pers.weapon->view_model);
 
+	// ### Hentai ### BEGIN
 	ent->client->anim_priority = ANIM_PAIN;
 	if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
 	{
@@ -205,6 +215,10 @@
 			ent->client->anim_end = FRAME_pain304;
 			
 	}
+	
+	ShowGun(ent);	
+
+	// ### Hentai ### END
 }
 
 /*
@@ -358,14 +372,12 @@
 #define FRAME_IDLE_FIRST		(FRAME_FIRE_LAST + 1)
 #define FRAME_DEACTIVATE_FIRST	(FRAME_IDLE_LAST + 1)
 
-void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent))
+static void Weapon_Generic2 (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent))
 {
 	int		n;
 
-	if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
-	{
-		return;
-	}
+	if(ent->s.modelindex != 255) // ### Hentai ### 
+		return; // not on client, so VWep animations could do wacky things
 
 	if (ent->client->weaponstate == WEAPON_DROPPING)
 	{
@@ -374,7 +386,8 @@
 			ChangeWeapon (ent);
 			return;
 		}
-		else if ((FRAME_DEACTIVATE_LAST - ent->client->ps.gunframe) == 4)
+		// ### Hentai ### BEGIN
+		else if((FRAME_DEACTIVATE_LAST - ent->client->ps.gunframe) == 4)
 		{
 			ent->client->anim_priority = ANIM_REVERSE;
 			if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
@@ -389,6 +402,7 @@
 				
 			}
 		}
+		// ### Hentai ### END
 
 		ent->client->ps.gunframe++;
 		return;
@@ -411,8 +425,8 @@
 	{
 		ent->client->weaponstate = WEAPON_DROPPING;
 		ent->client->ps.gunframe = FRAME_DEACTIVATE_FIRST;
-
-		if ((FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < 4)
+		// ### Hentai ### BEGIN
+		if((FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < 4)
 		{
 			ent->client->anim_priority = ANIM_REVERSE;
 			if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
@@ -427,6 +441,7 @@
 				
 			}
 		}
+		// ### Hentai ### END
 		return;
 	}
 
@@ -495,8 +510,14 @@
 		{
 			if (ent->client->ps.gunframe == fire_frames[n])
 			{
+//ZOID
+				if (!CTFApplyStrengthSound(ent))
+//ZOID
 				if (ent->client->quad_framenum > level.framenum)
 					gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage3.wav"), 1, ATTN_NORM, 0);
+//ZOID
+				CTFApplyHasteSound(ent);
+//ZOID
 
 				fire (ent);
 				break;
@@ -511,6 +532,33 @@
 	}
 }
 
+//ZOID
+void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent))
+{
+	int oldstate = ent->client->weaponstate;
+
+	if (ent->s.modelindex != 255) // ### Hentai ### 
+		return; // not on client, so VWep animations could do wacky things
+
+	Weapon_Generic2 (ent, FRAME_ACTIVATE_LAST, FRAME_FIRE_LAST, 
+		FRAME_IDLE_LAST, FRAME_DEACTIVATE_LAST, pause_frames, 
+		fire_frames, fire);
+
+	// run the weapon frame again if hasted
+	if (stricmp(ent->client->pers.weapon->pickup_name, "Grapple") == 0 &&
+		ent->client->weaponstate == WEAPON_FIRING)
+		return;
+
+	if ((CTFApplyHaste(ent) ||
+		(Q_stricmp(ent->client->pers.weapon->pickup_name, "Grapple") == 0 &&
+		ent->client->weaponstate != WEAPON_FIRING))
+		&& oldstate == ent->client->weaponstate) {
+		Weapon_Generic2 (ent, FRAME_ACTIVATE_LAST, FRAME_FIRE_LAST, 
+			FRAME_IDLE_LAST, FRAME_DEACTIVATE_LAST, pause_frames, 
+			fire_frames, fire);
+	}
+}
+//ZOID
 
 /*
 ======================================================================
@@ -546,28 +594,28 @@
 	speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
 	fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);
 
-	if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
-		ent->client->pers.inventory[ent->client->ammo_index]--;
-
-	ent->client->grenade_time = level.time + 1.0;
-
-	if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
-	{
+	// ### Hentai ### BEGIN
+	if(ent->deadflag || ent->s.modelindex != 255)
 		return;
-	}
 
-	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
+	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED )
 	{
 		ent->client->anim_priority = ANIM_ATTACK;
 		ent->s.frame = FRAME_crattak1-1;
 		ent->client->anim_end = FRAME_crattak3;
 	}
-	else
+	else if(ent->s.modelindex != 255)
 	{
 		ent->client->anim_priority = ANIM_REVERSE;
 		ent->s.frame = FRAME_wave08;
 		ent->client->anim_end = FRAME_wave01;
 	}
+	// ### Hentai ### END
+
+	if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
+		ent->client->pers.inventory[ent->client->ammo_index]--;
+
+	ent->client->grenade_time = level.time + 1.0;
 }
 
 void Weapon_Grenade (edict_t *ent)
@@ -629,7 +677,7 @@
 			if (!ent->client->grenade_time)
 			{
 				ent->client->grenade_time = level.time + GRENADE_TIMER + 0.2;
-				ent->client->weapon_sound = gi.soundindex("weapons/hgrenc1b.wav");
+				//ent->client->weapon_sound = gi.soundindex("weapons/hgrenc1b.wav");
 			}
 
 			// they waited too long, detonate it in their hand
@@ -883,8 +931,8 @@
 			else
 				damage = 20;
 			Blaster_Fire (ent, offset, damage, true, effect);
-			if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
-				ent->client->pers.inventory[ent->client->ammo_index]--;
+			
+			// ### Hentai ### BEGIN
 
 			ent->client->anim_priority = ANIM_ATTACK;
 			if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
@@ -897,6 +945,11 @@
 				ent->s.frame = FRAME_attack1 - 1;
 				ent->client->anim_end = FRAME_attack8;
 			}
+	
+			// ### Hentai ### END
+
+			if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
+				ent->client->pers.inventory[ent->client->ammo_index]--;
 		}
 
 		ent->client->ps.gunframe++;
@@ -997,9 +1050,7 @@
 	gi.multicast (ent->s.origin, MULTICAST_PVS);
 
 	PlayerNoise(ent, start, PNOISE_WEAPON);
-
-	if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
-		ent->client->pers.inventory[ent->client->ammo_index]--;
+	// ### Hentai ### BEGIN
 
 	ent->client->anim_priority = ANIM_ATTACK;
 	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
@@ -1012,6 +1063,11 @@
 		ent->s.frame = FRAME_attack1 - (int) (random()+0.25);
 		ent->client->anim_end = FRAME_attack8;
 	}
+
+	// ### Hentai ### END
+
+	if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
+		ent->client->pers.inventory[ent->client->ammo_index]--;
 }
 
 void Weapon_Machinegun (edict_t *ent)
@@ -1067,6 +1123,8 @@
 		ent->client->weapon_sound = gi.soundindex("weapons/chngnl1a.wav");
 	}
 
+		// ### Hentai ### BEGIN
+
 	ent->client->anim_priority = ANIM_ATTACK;
 	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
 	{
@@ -1079,6 +1137,8 @@
 		ent->client->anim_end = FRAME_attack8;
 	}
 
+	// ### Hentai ### END
+
 	if (ent->client->ps.gunframe <= 9)
 		shots = 1;
 	else if (ent->client->ps.gunframe <= 14)
@@ -1137,6 +1197,7 @@
 
 	PlayerNoise(ent, start, PNOISE_WEAPON);
 
+
 	if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
 		ent->client->pers.inventory[ent->client->ammo_index] -= shots;
 }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.