Skip to content

Commit

Permalink
Merge branch 'alwaysfullammoguns'
Browse files Browse the repository at this point in the history
  • Loading branch information
dedavidd committed Dec 11, 2018
2 parents 669c476 + 7c89b3d commit 20cf66c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
22 changes: 12 additions & 10 deletions code/game/g_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,18 @@ int Pickup_Weapon (gentity_t *ent, gentity_t *other) {
quantity = ent->item->quantity;
}

// dropped items and teamplay weapons always have full ammo
if ( ! (ent->flags & FL_DROPPED_ITEM) && g_gametype.integer != GT_TEAM ) {
// respawning rules
// drop the quantity if the already have over the minimum
if ( other->client->ps.ammo[ ent->item->giTag ] < quantity ) {
quantity = quantity - other->client->ps.ammo[ ent->item->giTag ];
} else {
quantity = 1; // only add a single shot
}
}
// dropped items and teamplay weapons always have full ammo
if ( ! (ent->flags & FL_DROPPED_ITEM) && g_gametype.integer != GT_TEAM ) {
if ( g_legacyWeaponAmmo.integer == 1 ) {
// respawning rules
// drop the quantity if the already have over the minimum
if ( other->client->ps.ammo[ ent->item->giTag ] < quantity ) {
quantity = quantity - other->client->ps.ammo[ ent->item->giTag ];
} else {
quantity = 1; // only add a single shot
}
}
}
}

//G_Printf("%i \n", quantity );
Expand Down
2 changes: 2 additions & 0 deletions code/game/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,8 @@ extern vmCvar_t g_telefragTeamBehavior;
extern vmCvar_t g_furthestTeamSpawns;
extern vmCvar_t g_ruleset;


extern vmCvar_t g_legacyWeaponAmmo;
// Weapon CVARs

// Gauntlet
Expand Down
2 changes: 2 additions & 0 deletions code/game/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ vmCvar_t g_allowMultiview;
vmCvar_t g_disableSpecs;

vmCvar_t g_friendsThroughWalls;
vmCvar_t g_legacyWeaponAmmo;
vmCvar_t g_allowKill;
vmCvar_t g_fadeToBlack;

Expand Down Expand Up @@ -595,6 +596,7 @@ static cvarTable_t gameCvarTable[] = {
{ &g_disableSpecs, "g_disableSpecs", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_friendsThroughWalls, "g_friendsThroughWalls", "0", CVAR_SERVERINFO, 0, qfalse },

{ &g_legacyWeaponAmmo, "g_legacyWeaponAmmo", "1", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse },
{ &g_allowKill, "g_allowKill", "1", CVAR_SERVERINFO, 0, qfalse },
{ &g_fadeToBlack, "g_fadeToBlack", "0", CVAR_SERVERINFO, 0, qfalse },
{ &g_spawnProtection, "g_spawnProtection", "0", CVAR_ARCHIVE, 0, qfalse },
Expand Down

0 comments on commit 20cf66c

Please sign in to comment.