mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-10 07:11:36 +00:00
Elder:
Added/fixed the weapon ammo problem on a dropped weapon (note: mimics AQ2 behaviour, which is not "real" ammo in the gun =)
This commit is contained in:
parent
bdca3c4d38
commit
7af551c738
6 changed files with 46 additions and 7 deletions
|
@ -876,8 +876,10 @@ void ThrowWeapon( gentity_t *ent )
|
|||
//if( client->ps.weapon == WP_KNIFE || client->ps.weapon == WP_PISTOL || client->ps.weapon == WP_GRENADE || ( ucmd->buttons & BUTTON_ATTACK ))
|
||||
// return;
|
||||
|
||||
//Elder: TODO: have to add a reloading case:
|
||||
//weaponTime > 0 or weaponState == weapon_dropping? Or both?
|
||||
//Still firing
|
||||
if (ucmd->buttons & BUTTON_ATTACK) {
|
||||
if (ucmd->buttons & BUTTON_ATTACK || client->ps.weaponTime > 0) {
|
||||
return;
|
||||
}
|
||||
//Elder: Bandaging case
|
||||
|
@ -886,8 +888,7 @@ void ThrowWeapon( gentity_t *ent )
|
|||
return;
|
||||
}
|
||||
|
||||
//Elder: have to add a reloading case
|
||||
|
||||
|
||||
weap = 0;
|
||||
if (client->ps.stats[STAT_UNIQUEWEAPONS] > 0)
|
||||
{
|
||||
|
@ -907,7 +908,9 @@ void ThrowWeapon( gentity_t *ent )
|
|||
|
||||
//Elder: Send a server command instead of force-setting
|
||||
//client->ps.weapon = WP_PISTOL;
|
||||
client->ps.ammo[ weap ] = 0;
|
||||
//Elder: Don't reset the weapon ammo
|
||||
//client->ps.ammo[ weap ] = 0;
|
||||
client->hadUniqueWeapon[weap] = qtrue;
|
||||
trap_SendServerCommand( ent-g_entities, va("selectpistol"));
|
||||
|
||||
client->ps.stats[STAT_WEAPONS] &= ~( 1 << weap);
|
||||
|
|
|
@ -1040,6 +1040,9 @@ void ClientSpawn(gentity_t *ent) {
|
|||
int eventSequence;
|
||||
char userinfo[MAX_INFO_STRING];
|
||||
|
||||
//To save the ammo stuff
|
||||
qboolean hadUniqueWeapon[MAX_WEAPONS];
|
||||
|
||||
index = ent - g_entities;
|
||||
client = ent->client;
|
||||
|
||||
|
@ -1101,6 +1104,11 @@ void ClientSpawn(gentity_t *ent) {
|
|||
accuracy_hits = client->accuracy_hits;
|
||||
accuracy_shots = client->accuracy_shots;
|
||||
|
||||
//Elder: save unique weapon info
|
||||
for ( i = 0 ; i < MAX_WEAPONS ; i++ ) {
|
||||
hadUniqueWeapon[i] = client->hadUniqueWeapon[i];
|
||||
}
|
||||
|
||||
for ( i = 0 ; i < MAX_PERSISTANT ; i++ ) {
|
||||
persistant[i] = client->ps.persistant[i];
|
||||
}
|
||||
|
@ -1120,6 +1128,11 @@ void ClientSpawn(gentity_t *ent) {
|
|||
client->accuracy_shots = accuracy_shots;
|
||||
client->lastkilled_client = -1;
|
||||
|
||||
//Elder: restore unique weapon info
|
||||
for ( i = 0 ; i < MAX_WEAPONS ; i++ ) {
|
||||
client->hadUniqueWeapon[i] = hadUniqueWeapon[i];
|
||||
}
|
||||
|
||||
for ( i = 0 ; i < MAX_PERSISTANT ; i++ ) {
|
||||
client->ps.persistant[i] = persistant[i];
|
||||
}
|
||||
|
|
|
@ -1601,6 +1601,13 @@ void Cmd_Bandage (gentity_t *ent)
|
|||
//Elder: can't use events
|
||||
//G_AddEvent(ent,EV_ZOOM,0);
|
||||
//}
|
||||
|
||||
//Elder: added so you can't "rebandage"
|
||||
if (ent->client->isBandaging == qtrue) {
|
||||
trap_SendServerCommand( ent-g_entities, va("print \"You are already bandaging!\n\""));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ent->client->bleeding || (ent->client->ps.stats[STAT_RQ3] & RQ3_LEGDAMAGE) == RQ3_LEGDAMAGE)
|
||||
{
|
||||
ent->client->ps.weaponstate = WEAPON_DROPPING;
|
||||
|
|
|
@ -101,29 +101,36 @@ void TossClientItems( gentity_t *self ) {
|
|||
//BTW, that means no cheating to get all weapons or it'll spawn mad!!
|
||||
weaponInventory = self->client->ps.stats[STAT_WEAPONS];
|
||||
|
||||
//Elder: added hadUniqueWeapons check - returns to qfalse if died with the gun
|
||||
//as opposed to dropping it, then died
|
||||
if ( (weaponInventory & (1 << WP_M3) ) == (1 << WP_M3) ) {
|
||||
item = BG_FindItemForWeapon( WP_M3 );
|
||||
Drop_Item( self, item, 0);
|
||||
self->client->hadUniqueWeapon[ WP_M3 ] = qfalse;
|
||||
}
|
||||
|
||||
if ( (weaponInventory & (1 << WP_M4) ) == (1 << WP_M4) ) {
|
||||
item = BG_FindItemForWeapon( WP_M4 );
|
||||
Drop_Item( self, item, 0);
|
||||
self->client->hadUniqueWeapon[ WP_M4 ] = qfalse;
|
||||
}
|
||||
|
||||
if ( (weaponInventory & (1 << WP_MP5) ) == (1 << WP_MP5) ) {
|
||||
item = BG_FindItemForWeapon( WP_MP5 );
|
||||
Drop_Item( self, item, 0);
|
||||
self->client->hadUniqueWeapon[ WP_MP5 ] = qfalse;
|
||||
}
|
||||
|
||||
if ( (weaponInventory & (1 << WP_HANDCANNON) ) == (1 << WP_HANDCANNON) ) {
|
||||
item = BG_FindItemForWeapon( WP_HANDCANNON );
|
||||
Drop_Item( self, item, 0);
|
||||
self->client->hadUniqueWeapon[ WP_HANDCANNON ] = qfalse;
|
||||
}
|
||||
|
||||
if ( (weaponInventory & (1 << WP_SSG3000) ) == (1 << WP_SSG3000) ) {
|
||||
item = BG_FindItemForWeapon( WP_SSG3000 );
|
||||
Drop_Item( self, item, 0);
|
||||
self->client->hadUniqueWeapon[ WP_SSG3000 ] = qfalse;
|
||||
}
|
||||
|
||||
//Elder: Always drop the pistol
|
||||
|
|
|
@ -388,8 +388,12 @@ int Pickup_Weapon (gentity_t *ent, gentity_t *other) {
|
|||
ammotoadd=30;
|
||||
break;
|
||||
}
|
||||
//Elder: conditional added to "restore" weapons
|
||||
if ( other->client->hadUniqueWeapon[ent->item->giTag] == qfalse ||
|
||||
!((ent->flags & FL_THROWN_ITEM) == FL_THROWN_ITEM) ) {
|
||||
other->client->ps.ammo[ent->item->giTag]= ammotoadd;
|
||||
}
|
||||
|
||||
other->client->ps.ammo[ent->item->giTag]= ammotoadd;
|
||||
// End Duffman
|
||||
|
||||
|
||||
|
@ -899,6 +903,10 @@ gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity, int xr_fla
|
|||
dropped->physicsBounce= 0;
|
||||
}
|
||||
|
||||
//Elder: suspend thrown knives so it doesn't jitter
|
||||
//if (item->giTag == WP_KNIFE)
|
||||
//dropped->spawnflags |= 1; //suspended
|
||||
|
||||
trap_LinkEntity (dropped);
|
||||
|
||||
return dropped;
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef enum {
|
|||
|
||||
#define SP_PODIUM_MODEL "models/mapobjects/podium/podium4.md3"
|
||||
|
||||
#define RQ3_RESPAWNTIME_DEFAULT 30000 // Elder: time for weapons to respawn
|
||||
#define RQ3_RESPAWNTIME_DEFAULT 60000 // Elder: time for weapons to respawn - up to 60s
|
||||
|
||||
#define SP_AUTOOPEN 128 // Elder: revert to Q3 behaviour
|
||||
#define SP_NODOORTOGGLE 256 // Elder: added to disable mover toggling
|
||||
|
@ -354,7 +354,8 @@ struct gclient_s {
|
|||
// end Homer
|
||||
|
||||
//Elder: prep for "ammo" in last gun
|
||||
int lastGunAmmo[MAX_WEAPONS];
|
||||
//Only the server needs to know this
|
||||
qboolean hadUniqueWeapon[MAX_WEAPONS];
|
||||
|
||||
#ifdef MISSIONPACK
|
||||
gentity_t *persistantPowerup;
|
||||
|
|
Loading…
Reference in a new issue