No Doom weapons when cheating

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

No Doom weapons when cheating

Post by Tormentor667 »

Currently working on a new mod and when using the "give all" console cheat or ID(K)FA, I always get the original Doom weapons next to my new weapons even though I have created a new area in the MAPINFO gameinfo lump:

Code: Select all

gameinfo
{
	PlayerClasses = "NewPlayer"

	weaponslot = 1, "Melee", "Firebrand"
	weaponslot = 2, "Luger9mm", "Walther9mm"
	weaponslot = 3, "TrenchShotgun", "Browning5"
	weaponslot = 4, "Thompson", "MP40"
	weaponslot = 5, "G41", "Enfield"
	weaponslot = 6, "STG44", "FG42"
	weaponslot = 7, "Pyrolight"
	weaponslot = 8, "Nebelwerfer", "Panzerschreck"
	weaponslot = 9, "UMG43"
}
How can I avoid this behaviour?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49246
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: No Doom weapons when cheating

Post by Graf Zahl »

The source says:

Code: Select all

				// Give the weapon only if it belongs to the current game or
				// is in a weapon slot. 
Since all the original weapons belong to game Doom, you cannot disable this.
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Re: No Doom weapons when cheating

Post by Tormentor667 »

Is there a workaround or a hack somehow to disable this by replacing the original weapons or things like that?

*EDIT*
Replacing the original weapons indeed does the job, for those who need something similar.
User avatar
zrrion the insect
Posts: 2432
Joined: Thu Jun 25, 2009 1:58 pm
Location: Time Station 1: Moon of Glendale

Re: No Doom weapons when cheating

Post by zrrion the insect »

Did you do something like this:

Code: Select all

Actor DeathToShotguns replaces Shotgun
{
//nothing here
}
Or did you have the new weapons you made replace the stock weapons?
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: No Doom weapons when cheating

Post by Ed the Bat »

Either of those would do the trick. As long as SOMETHING replaces a weapon, it won't be slotted, even if it has Weapon.SlotNumber defined.

Code: Select all

	if (cls->ActorInfo != NULL &&
			(cls->ActorInfo->GameFilter == GAME_Any || (cls->ActorInfo->GameFilter & gameinfo.gametype)) &&
			cls->ActorInfo->Replacement == NULL &&	// Replaced weapons don't get slotted.
			cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)) &&
			!(static_cast<AWeapon*>(GetDefaultByType(cls))->WeaponFlags & WIF_POWERED_UP) &&
			!LocateWeapon(cls, NULL, NULL)			// Don't duplicate it if it's already present.
			)
		{
			int slot = cls->Meta.GetMetaInt(AWMETA_SlotNumber, -1);
			if ((unsigned)slot < NUM_WEAPON_SLOTS)
			{
				fixed_t position = cls->Meta.GetMetaFixed(AWMETA_SlotPriority, INT_MAX);
				FWeaponSlot::WeaponInfo info = { cls, position };
				Slots[slot].Weapons.Push(info);
			}
		}
Once in a while I have to work around this for special cases, but on the whole, I think it's probably good that this is here.
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Re: No Doom weapons when cheating

Post by Tormentor667 »

zrrion the insect wrote:Or did you have the new weapons you made replace the stock weapons?
That :)
Locked

Return to “Editing (Archive)”