mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-02-20 19:02:08 +00:00
Elder:
Fixed/optimized the weapon drop/item pick-up code
This commit is contained in:
parent
e02ad6dcd3
commit
4c5f58c8cf
3 changed files with 82 additions and 25 deletions
|
@ -101,6 +101,16 @@ qboolean JumpKick( gentity_t *ent )
|
|||
G_Damage( traceEnt, ent, ent, forward, tr.endpos,
|
||||
damage, DAMAGE_NO_LOCATIONAL, MOD_KICK );
|
||||
|
||||
//Elder: for the kick
|
||||
// do our special form of knockback here
|
||||
/*
|
||||
VectorMA (self->enemy->absmin, 0.5, self->enemy->size, v);
|
||||
VectorSubtract (v, point, v);
|
||||
VectorNormalize (v);
|
||||
VectorMA (self->enemy->velocity, kick, v, self->enemy->velocity);
|
||||
if (self->enemy->velocity[2] > 0)
|
||||
self->enemy->groundentity = NULL;
|
||||
*/
|
||||
//Elder: Our set of locally called sounds
|
||||
G_AddEvent ( ent, EV_RQ3_SOUND, RQ3_SOUND_KICK);
|
||||
return qtrue;
|
||||
|
@ -890,12 +900,12 @@ void ThrowWeapon( gentity_t *ent )
|
|||
if (weap == 0 ) return;
|
||||
xr_item = BG_FindItemForWeapon( weap );
|
||||
|
||||
//Elder: moved up
|
||||
client->ps.weapon = WP_PISTOL;
|
||||
//Elder: Send a server command instead of force-setting
|
||||
//client->ps.weapon = WP_PISTOL;
|
||||
client->ps.ammo[ weap ] = 0;
|
||||
trap_SendServerCommand( ent-g_entities, va("selectpistol"));
|
||||
|
||||
client->ps.stats[STAT_WEAPONS] &= ~( 1 << weap);
|
||||
//client->ps.weapon = WP_PISTOL;
|
||||
xr_drop= dropWeapon( ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM );
|
||||
xr_drop->count= -1; // XRAY FMJ 0 is already taken, -1 means no ammo
|
||||
client->ps.stats[STAT_UNIQUEWEAPONS]--;
|
||||
|
|
|
@ -281,11 +281,12 @@ int Pickup_Weapon (gentity_t *ent, gentity_t *other) {
|
|||
quantity = 0; // None for you, sir!
|
||||
} else {
|
||||
if ( ent->count ) {
|
||||
//Elder: place to put gun's chamber ammo?
|
||||
quantity = ent->count;
|
||||
} else {
|
||||
quantity = ent->item->quantity;
|
||||
}
|
||||
|
||||
/* Elder: commented out
|
||||
// dropped items and teamplay weapons always have full ammo
|
||||
if ( ! (ent->flags & FL_DROPPED_ITEM) && g_gametype.integer != GT_TEAM ) {
|
||||
// respawning rules
|
||||
|
@ -295,7 +296,7 @@ int Pickup_Weapon (gentity_t *ent, gentity_t *other) {
|
|||
} else {
|
||||
quantity = 1; // only add a single shot
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
// add the weapon
|
||||
|
@ -354,7 +355,7 @@ int Pickup_Weapon (gentity_t *ent, gentity_t *other) {
|
|||
other->client->ps.stats[STAT_UNIQUEWEAPONS]++;
|
||||
break;
|
||||
case WP_M3:
|
||||
ammotoadd= RQ3_M3_AMMO ;
|
||||
ammotoadd= RQ3_M3_AMMO;
|
||||
other->client->ps.stats[STAT_UNIQUEWEAPONS]++;
|
||||
break;
|
||||
case WP_HANDCANNON:
|
||||
|
@ -383,6 +384,7 @@ int Pickup_Weapon (gentity_t *ent, gentity_t *other) {
|
|||
break;
|
||||
default:
|
||||
//Blaze: Should never hit here
|
||||
G_Printf("Pickup_Weapon given bad giTag: %d\n", ent->item->giTag);
|
||||
ammotoadd=30;
|
||||
break;
|
||||
}
|
||||
|
@ -575,8 +577,46 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
|
|||
case IT_WEAPON:
|
||||
switch(ent->item->giTag)
|
||||
{
|
||||
//Blaze: Check to see if we already have the weapon, If not so check and see if we have less then full ammo, if so pick up gun
|
||||
//Elder: this is really confusing - FIXME
|
||||
//Blaze: Check to see if we already have the weapon,
|
||||
//If not so check and see if we have less then full ammo, if so pick up gun
|
||||
//Elder's version:
|
||||
//Accumulators (e.g. knife, grenade): if you have the weap AND the max limit, leave
|
||||
//Pistols: if you have akimbos AND max clips, leave
|
||||
//Akimbos: shouldn't pick them up b/c they shouldn't be dropped
|
||||
//Specials: if you have more than/equal to limit (remember bando later), leave
|
||||
case WP_KNIFE:
|
||||
if ( (other->client->ps.stats[STAT_WEAPONS] & (1 << WP_KNIFE) == (1 << WP_KNIFE) ) &&
|
||||
(other->client->ps.ammo[ent->item->giTag] >= RQ3_KNIFE_MAXCLIP) )
|
||||
return;
|
||||
break;
|
||||
case WP_GRENADE:
|
||||
if ( (other->client->ps.stats[STAT_WEAPONS] & (1 << WP_GRENADE) == (1 << WP_GRENADE) ) &&
|
||||
(other->client->ps.ammo[ent->item->giTag] >= RQ3_GRENADE_MAXCLIP) )
|
||||
return;
|
||||
break;
|
||||
case WP_PISTOL:
|
||||
//Elder: always have pistol - but extra ones give akimbo or clips
|
||||
if ( (other->client->ps.stats[STAT_WEAPONS] & (1 << WP_AKIMBO) == (1 << WP_AKIMBO) ) &&
|
||||
other->client->ps.stats[ent->item->giTag] >= RQ3_PISTOL_MAXCLIP)
|
||||
//leave if we have max clips and akimbos
|
||||
return;
|
||||
break;
|
||||
case WP_M3:
|
||||
case WP_HANDCANNON:
|
||||
case WP_MP5:
|
||||
case WP_M4:
|
||||
case WP_SSG3000:
|
||||
if (other->client->ps.stats[STAT_UNIQUEWEAPONS] >= g_rxn_maxweapons.integer)
|
||||
return;
|
||||
break;
|
||||
case WP_AKIMBO:
|
||||
default:
|
||||
//Elder: shouldn't be here
|
||||
G_Printf("Touch_Item received invalid IT_WEAPON giTag: %d\n", ent->item->giTag);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case WP_KNIFE:
|
||||
if (!other->client->ps.stats[STAT_WEAPONS] & WP_KNIFE == WP_KNIFE &&
|
||||
(other->client->ps.ammo[ent->item->giTag] >= RQ3_KNIFE_MAXCLIP) )
|
||||
|
@ -626,7 +666,7 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
|
|||
(other->client->ps.ammo[ent->item->giTag] >= RQ3_GRENADE_MAXCLIP))
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
//Blaze: Check and see if it's a unique weapon, and if so make sure they dont have too many already
|
||||
if (ent->item->giTag == WP_MP5 || ent->item->giTag == WP_M4 ||
|
||||
ent->item->giTag == WP_M3 || ent->item->giTag == WP_HANDCANNON ||
|
||||
|
@ -635,7 +675,8 @@ void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
respawn = Pickup_Weapon(ent, other);
|
||||
respawn = -1; //Dont respawn weapons
|
||||
|
||||
|
|
|
@ -325,27 +325,33 @@ struct gclient_s {
|
|||
// like health / armor countdowns and regeneration
|
||||
int timeResidual;
|
||||
|
||||
int bleeding; //Blaze: remaining points to bleed away
|
||||
int bleed_remain;//Blaze: How much left to bleed
|
||||
int bleedloc; //Blaze: Where are we bleeding
|
||||
vec3_t bleedloc_offset;// Blaze: location of bleeding (from origin)
|
||||
int bleeding; //Blaze: remaining points to bleed away
|
||||
int bleed_remain; //Blaze: How much left to bleed
|
||||
int bleedloc; //Blaze: Where are we bleeding
|
||||
vec3_t bleedloc_offset; // Blaze: location of bleeding (from origin)
|
||||
vec3_t bleednorm;
|
||||
//qboolean isBleeding;//Blaze: is client bleeding
|
||||
int legDamage;//Blaze: Client has leg damage - holds number of hits too
|
||||
int bleedtick;//Blaze: Holds # of seconds till bleeding stops.
|
||||
//qboolean isBleeding; //Blaze: is client bleeding
|
||||
int legDamage; //Blaze: Client has leg damage - holds number of hits too
|
||||
int bleedtick; //Blaze: Holds # of seconds till bleeding stops.
|
||||
|
||||
//Elder: server only needs to know for sniper spread - ARGH
|
||||
int zoomed; // Hawkins (SSG zoom)
|
||||
//qboolean semi; // hawkins (semiauto mode for m4, mp5, pistol)
|
||||
int shots; //Blaze: Number of shots fired so far with this weapon
|
||||
int zoomed; // Hawkins (SSG zoom)
|
||||
//qboolean semi; // hawkins (semiauto mode for m4, mp5, pistol)
|
||||
int shots; //Blaze: Number of shots fired so far with this weapon
|
||||
|
||||
// Homer: weaponstate vars for Cmd_Weapon
|
||||
// make these a single bitmask? worth the effort?
|
||||
int mk23semi; // pistol to semi-auto
|
||||
int mp5_3rb; // MP5 to 3rb
|
||||
int m4_3rb; // M4 to 3rb
|
||||
int grenRange; // range to throw grenade (short/medium/long)
|
||||
int throwKnife; // knife to throwing
|
||||
int mk23semi; // pistol to semi-auto
|
||||
int mp5_3rb; // MP5 to 3rb
|
||||
int m4_3rb; // M4 to 3rb
|
||||
int grenRange; // range to throw grenade (short/medium/long)
|
||||
int throwKnife; // knife to throwing
|
||||
qboolean isBandaging; //Elder: player in the process of bandaging
|
||||
// end Homer
|
||||
|
||||
//Elder: prep for "ammo" in last gun
|
||||
int lastGunAmmo[MAX_WEAPONS];
|
||||
|
||||
#ifdef MISSIONPACK
|
||||
gentity_t *persistantPowerup;
|
||||
int portalID;
|
||||
|
|
Loading…
Reference in a new issue