mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-30 16:00:55 +00:00
- Added Hirogen2's patch for unlimited ammo CVAR.
SVN r1464 (trunk)
This commit is contained in:
parent
ee1806e9b2
commit
e57ff454f2
5 changed files with 13 additions and 5 deletions
|
@ -1,4 +1,7 @@
|
|||
March 4, 2009
|
||||
March 6, 2009 (Changes by Graf Zahl)
|
||||
- Added Hirogen2's patch for unlimited ammo CVAR.
|
||||
|
||||
March 4, 2009
|
||||
- Fixed: You couldn't easily play with the compatibility options menu during
|
||||
the title screen, because the demo loop reset the server cvars after each
|
||||
attempt to play a demo, even though the demos never actually played. The
|
||||
|
|
|
@ -73,6 +73,7 @@ extern FILE *Logfile;
|
|||
extern bool insave;
|
||||
|
||||
CVAR (Bool, sv_cheats, false, CVAR_SERVERINFO | CVAR_LATCH)
|
||||
CVAR (Bool, sv_unlimited_pickup, false, CVAR_ARCHIVE | CVAR_SERVERINFO)
|
||||
|
||||
CCMD (toggleconsole)
|
||||
{
|
||||
|
|
|
@ -143,6 +143,7 @@ EXTERN_CVAR (Bool, invertmouse)
|
|||
EXTERN_CVAR (Bool, lookstrafe)
|
||||
EXTERN_CVAR (Int, screenblocks)
|
||||
EXTERN_CVAR (Bool, sv_cheats)
|
||||
EXTERN_CVAR (Bool, sv_unlimited_pickup)
|
||||
|
||||
extern gameinfo_t SharewareGameInfo;
|
||||
extern gameinfo_t RegisteredGameInfo;
|
||||
|
@ -2369,6 +2370,7 @@ void D_DoomMain (void)
|
|||
if (Args->CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS;
|
||||
if (Args->CheckParm ("-respawn")) flags |= DF_MONSTERS_RESPAWN;
|
||||
if (Args->CheckParm ("-fast")) flags |= DF_FAST_MONSTERS;
|
||||
if (Args->CheckParm("-ulp")) sv_unlimited_pickup = true;
|
||||
|
||||
devparm = !!Args->CheckParm ("-devparm");
|
||||
|
||||
|
|
|
@ -67,13 +67,14 @@ const PClass *AAmmo::GetParentAmmo () const
|
|||
// AAmmo :: HandlePickup
|
||||
//
|
||||
//===========================================================================
|
||||
EXTERN_CVAR(Bool, sv_unlimited_pickup)
|
||||
|
||||
bool AAmmo::HandlePickup (AInventory *item)
|
||||
{
|
||||
if (GetClass() == item->GetClass() ||
|
||||
(item->IsKindOf (RUNTIME_CLASS(AAmmo)) && static_cast<AAmmo*>(item)->GetParentAmmo() == GetClass()))
|
||||
{
|
||||
if (Amount < MaxAmount)
|
||||
if (Amount < MaxAmount || sv_unlimited_pickup)
|
||||
{
|
||||
int receiving = item->Amount;
|
||||
|
||||
|
@ -84,7 +85,7 @@ bool AAmmo::HandlePickup (AInventory *item)
|
|||
int oldamount = Amount;
|
||||
|
||||
Amount += receiving;
|
||||
if (Amount > MaxAmount)
|
||||
if (Amount > MaxAmount && !sv_unlimited_pickup)
|
||||
{
|
||||
Amount = MaxAmount;
|
||||
}
|
||||
|
|
|
@ -326,10 +326,11 @@ AAmmo *AWeapon::AddAmmo (AActor *other, const PClass *ammotype, int amount)
|
|||
// Give the owner some more ammo he already has.
|
||||
//
|
||||
//===========================================================================
|
||||
EXTERN_CVAR(Bool, sv_unlimited_pickup)
|
||||
|
||||
bool AWeapon::AddExistingAmmo (AAmmo *ammo, int amount)
|
||||
{
|
||||
if (ammo != NULL && ammo->Amount < ammo->MaxAmount)
|
||||
if (ammo != NULL && (ammo->Amount < ammo->MaxAmount || sv_unlimited_pickup))
|
||||
{
|
||||
// extra ammo in baby mode and nightmare mode
|
||||
if (!(ItemFlags&IF_IGNORESKILL))
|
||||
|
@ -337,7 +338,7 @@ bool AWeapon::AddExistingAmmo (AAmmo *ammo, int amount)
|
|||
amount = FixedMul(amount, G_SkillProperty(SKILLP_AmmoFactor));
|
||||
}
|
||||
ammo->Amount += amount;
|
||||
if (ammo->Amount > ammo->MaxAmount)
|
||||
if (ammo->Amount > ammo->MaxAmount && !sv_unlimited_pickup)
|
||||
{
|
||||
ammo->Amount = ammo->MaxAmount;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue