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

--- h:\quake2\code-3.14\game\p_weapon.c	Thu Feb 26 12:38:57 1998
+++ p_weapon.c	Wed Apr 01 14:43:35 1998
@@ -150,10 +150,38 @@
 
 The old weapon has been dropped all the way, so make the new one
 current
 ===============
 */
+
+// ### Hentai ### BEGIN
+void ShowGun(edict_t *ent)
+{
+	char heldmodel[128];
+	int len;
+
+	if(ent->s.modelindex != 255 || ent->deadflag || !ent->client->pers.weapon)
+	{
+		ent->s.modelindex2 = 0;
+		return;
+	}
+
+	strcpy(heldmodel, "players/");
+	strcat(heldmodel, Info_ValueForKey (ent->client->pers.userinfo, "skin"));
+	for(len = 8; heldmodel[len]; len++)
+	{
+		if(heldmodel[len] == '/')
+			heldmodel[++len] = '\0';
+	}
+	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;
@@ -179,10 +207,28 @@
 	}
 
 	ent->client->weaponstate = WEAPON_ACTIVATING;
 	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)
+	{
+			ent->s.frame = FRAME_crpain1;
+			ent->client->anim_end = FRAME_crpain4;
+	}
+	else
+	{
+			ent->s.frame = FRAME_pain301;
+			ent->client->anim_end = FRAME_pain304;
+			
+	}
+	
+	ShowGun(ent);	
+
+	// ### Hentai ### END
 }
 
 /*
 =================
 NoAmmoWeaponChange
@@ -336,18 +382,43 @@
 
 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		n;
 
+	// ### Hentai ### BEGIN
+	if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
+	{
+		return;
+	}
+	// ### Hentai ### END 
 	if (ent->client->weaponstate == WEAPON_DROPPING)
 	{
 		if (ent->client->ps.gunframe == FRAME_DEACTIVATE_LAST)
 		{
 			ChangeWeapon (ent);
 			return;
 		}
 
+			// ### 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)
+			{
+				ent->s.frame = FRAME_crpain4+1;
+				ent->client->anim_end = FRAME_crpain1;
+			}
+			else
+			{
+				ent->s.frame = FRAME_pain304+1;
+				ent->client->anim_end = FRAME_pain301;
+				
+			}
+		}
+		// ### Hentai ### END
+
+
 		ent->client->ps.gunframe++;
 		return;
 	}
 
 	if (ent->client->weaponstate == WEAPON_ACTIVATING)
@@ -365,10 +436,27 @@
 
 	if ((ent->client->newweapon) && (ent->client->weaponstate != WEAPON_FIRING))
 	{
 		ent->client->weaponstate = WEAPON_DROPPING;
 		ent->client->ps.gunframe = FRAME_DEACTIVATE_FIRST;
+				// ### 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)
+			{
+				ent->s.frame = FRAME_crpain4+1;
+				ent->client->anim_end = FRAME_crpain1;
+			}
+			else
+			{
+				ent->s.frame = FRAME_pain304+1;
+				ent->client->anim_end = FRAME_pain301;
+				
+			}
+		}
+		// ### Hentai ### END
 		return;
 	}
 
 	if (ent->client->weaponstate == WEAPON_READY)
 	{
@@ -484,10 +572,31 @@
 
 	timer = ent->client->grenade_time - level.time;
 	speed = GRENADE_MINSPEED + (GRENADE_TIMER - timer) * ((GRENADE_MAXSPEED - GRENADE_MINSPEED) / GRENADE_TIMER);
 	fire_grenade2 (ent, start, forward, damage, speed, timer, radius, held);
 
+	// ### Hentai ### BEGIN
+	if(ent->deadflag || ent->s.modelindex != 255) // VWep animations screw up corpses
+	{
+		return;
+	}
+
+	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
+	{
+		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;
 }
@@ -803,10 +912,28 @@
 			if (deathmatch->value)
 				damage = 15;
 			else
 				damage = 20;
 			Blaster_Fire (ent, offset, damage, true, effect);
+			
+			// ### Hentai ### BEGIN
+
+			ent->client->anim_priority = ANIM_ATTACK;
+			if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
+			{
+				ent->s.frame = FRAME_crattak1 - 1;
+				ent->client->anim_end = FRAME_crattak9;
+			}
+			else
+			{
+				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++;
@@ -906,10 +1033,27 @@
 	gi.WriteByte (MZ_MACHINEGUN | is_silenced);
 	gi.multicast (ent->s.origin, MULTICAST_PVS);
 
 	PlayerNoise(ent, start, PNOISE_WEAPON);
 
+	// ### Hentai ### BEGIN
+
+	ent->client->anim_priority = ANIM_ATTACK;
+	if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
+	{
+		ent->s.frame = FRAME_crattak1 - (int) (random()+0.25);
+		ent->client->anim_end = FRAME_crattak9;
+	}
+	else
+	{
+		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)
@@ -963,10 +1107,28 @@
 	else
 	{
 		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)
+	{
+		ent->s.frame = FRAME_crattak1 - (ent->client->ps.gunframe & 1);
+		ent->client->anim_end = FRAME_crattak9;
+	}
+	else
+	{
+		ent->s.frame = FRAME_attack1 - (ent->client->ps.gunframe & 1);
+		ent->client->anim_end = FRAME_attack8;
+	}
+
+
+	// ### Hentai ### END
+
+
 	if (ent->client->ps.gunframe <= 9)
 		shots = 1;
 	else if (ent->client->ps.gunframe <= 14)
 	{
 		if (ent->client->buttons & BUTTON_ATTACK)
@@ -1021,10 +1183,11 @@
 	gi.WriteByte ((MZ_CHAINGUN1 + shots - 1) | is_silenced);
 	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] -= shots;
 }
 
 

unix.superglobalmegacorp.com

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