[v 1.0] ZDoom Backpack Generator tool (DECORATE)

Any utility that assists in the creation of mods, assets, etc, go here. For example: Ultimate Doom Builder, Slade, WadSmoosh, Oblige, etc.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
Varyier
Posts: 1
Joined: Wed Jul 20, 2022 10:14 am
Contact:

[v 1.0] ZDoom Backpack Generator tool (DECORATE)

Post by Varyier »

Hi! I've created a tool that allows anyone to add multiple backpack items for their mods. This tool generates required DECORATE code according to the config file and DECORATE template. Also, it generates some SBARINFO code and packs everything into a WAD file.
All ammo limits are checked by CustomInventory items when player picks them up. Ammo limits to check are chosen according to the current backpack player carries (simple inventory item with appropriate Inventory.MaxAmount value).
Example WAD file with DECORATE, SBARINFO and test map MAP01 can be downloaded here: https://github.com/Varyier/zdoom-backpa ... kpacks.wad
More information, examples and source code available at https://github.com/varyier/zdoom-backpack-generator.

DECORATE template may look like this:

Code: Select all


// 
// ammo in player's inventory (real ammo from the POV of zdoom engine)
// 

actor ClipEx: Ammo
{
  Inventory.Icon "CLIPA0"
@BpkGenMoreProps(ClipEx)
}

actor ShellEx: Ammo
{
  Inventory.Icon "SHELA0"
@BpkGenMoreProps(ShellEx)
}

actor RocketAmmoEx: Ammo
{
  Inventory.Icon "ROCKA0"
@BpkGenMoreProps(RocketAmmoEx)
}

actor CellEx: Ammo
{
  Inventory.Icon "CELLA0"
@BpkGenMoreProps(CellEx)
}


//
// utility classes to check ammo in player's inventory
//

@BpkGenAmmoLimitsCheckerDefinition


// 
// backpack pickups
// 

actor SmallAmmoBag: @BpkGenAmmoLimitsChecker 15000
{
  Inventory.PickupMessage "Picked up a small ammo bag!"

  States
  {
  Spawn:
    BPAK A 0
    BPAK A 0 A_SetScale(0.5, 0.5)
    BPAK A -1
    Stop

@BpkGenMoreStates(SmallAmmoBag)
  }
}

actor BackpackEx: @BpkGenAmmoLimitsChecker replaces Backpack
{
  Height 26
  Inventory.PickupMessage "$GOTBACKPACK"

  States
  {
  Spawn:
    BPAK A -1
    Stop

@BpkGenMoreStates(BackpackEx)
  }
}

actor HeavyBackpack: @BpkGenAmmoLimitsChecker 15001
{
  Height 30
  Inventory.PickupMessage "A heavy backpack! For some heavy ammo amounts!"

  States
  {
  Spawn:
    BPAK A 0
    BPAK A 0 A_SetScale(1.3, 1.3)
    BPAK A 0 A_FadeOut(0.3)
  FadingLoop:
    BPAK A 10 A_FadeOut(0.1)
    BPAK A 10 A_FadeOut(0.1)
    BPAK A 10 A_FadeOut(0.1)
    BPAK A 10 A_FadeOut(0.1)
    BPAK A 10 A_FadeIn(0.1)
    BPAK A 10 A_FadeIn(0.1)
    BPAK A 10 A_FadeIn(0.1)
    BPAK A 30 Bright A_FadeIn(0.1)
    Loop

@BpkGenMoreStates(HeavyBackpack)
  }
}


// 
// ammo pickups
// 

actor SingleClipEx: @BpkGenAmmoLimitsChecker replaces Clip
{
  Inventory.PickupMessage "$GOTCLIP"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    CLIP A -1
    Stop
@BpkGenMoreStates(SingleClipEx)
  }
}

actor SomeShellsEx: @BpkGenAmmoLimitsChecker replaces Shell
{
  Inventory.PickupMessage "$GOTSHELLS"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    SHEL A -1
    Stop
@BpkGenMoreStates(SomeShellsEx)
  }
}

actor SingleRocketEx: @BpkGenAmmoLimitsChecker replaces RocketAmmo
{
  Inventory.PickupMessage "$GOTROCKET"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    ROCK A -1
    Stop
@BpkGenMoreStates(SingleRocketEx)
  }
}

actor SmallCellBoxEx: @BpkGenAmmoLimitsChecker replaces Cell
{
  Inventory.PickupMessage "$GOTCELL"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    CELL A -1
    Stop
@BpkGenMoreStates(SmallCellBoxEx)
  }
}

actor ClipBoxEx: @BpkGenAmmoLimitsChecker replaces ClipBox
{
  Inventory.PickupMessage "$GOTCLIPBOX"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    AMMO A -1
    Stop
@BpkGenMoreStates(ClipBoxEx)
  }
}

actor ShellBoxEx: @BpkGenAmmoLimitsChecker replaces ShellBox
{
  Inventory.PickupMessage "$GOTSHELLBOX"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    SBOX A -1
    Stop
@BpkGenMoreStates(ShellBoxEx)
  }
}

actor RocketBoxEx: @BpkGenAmmoLimitsChecker replaces RocketBox
{
  Inventory.PickupMessage "$GOTROCKBOX"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    BROK A -1
    Stop
@BpkGenMoreStates(RocketBoxEx)
  }
}

actor CellPackEx: @BpkGenAmmoLimitsChecker replaces CellPack
{
  Inventory.PickupMessage "$GOTCELLBOX"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    CELP A -1
    Stop
@BpkGenMoreStates(CellPackEx)
  }
}


//
// weapons (only those which use ammo)
// need two separated actors for each weapon:
// 1) a custom inventory, which supports 'Pickup' state - derived from ammo limits checking class
// 2) a weapon itself - those are real weapons from the POV of zdoom engine
//

actor PistolEx: Pistol
{
@BpkGenMoreProps(PistolEx)
}

actor PistolExThing: @BpkGenAmmoLimitsChecker replaces Pistol
{
  Inventory.PickupMessage "$PICKUP_PISTOL_DROPPED"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    PIST A -1
    Stop
@BpkGenMoreStates(PistolExThing)
  }
}

actor ShotgunEx: Shotgun
{
@BpkGenMoreProps(ShotgunEx)
}

actor ShotgunExThing: @BpkGenAmmoLimitsChecker replaces Shotgun
{
  Inventory.PickupMessage "$GOTSHOTGUN"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    SHOT A -1
    Stop
@BpkGenMoreStates(ShotgunExThing)
  }
}

actor ShotgunExDropped: @BpkGenAmmoLimitsChecker
{
  Inventory.PickupMessage "$GOTSHOTGUN"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    SHOT A -1
    Stop
@BpkGenMoreStates(ShotgunExDropped)
  }
}

actor SuperShotgunEx: SuperShotgun
{
@BpkGenMoreProps(SuperShotgunEx)
}

actor SuperShotgunExThing: @BpkGenAmmoLimitsChecker replaces SuperShotgun
{
  Inventory.PickupMessage "$GOTSHOTGUN2"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    SGN2 A -1
    Stop
@BpkGenMoreStates(SuperShotgunExThing)
  }
}

actor ChaingunEx: Chaingun
{
@BpkGenMoreProps(ChaingunEx)
}

actor ChaingunExThing: @BpkGenAmmoLimitsChecker replaces Chaingun
{
  Inventory.PickupMessage "$GOTCHAINGUN"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    MGUN A -1
    Stop
@BpkGenMoreStates(ChaingunExThing)
  }
}

actor ChaingunExDropped: @BpkGenAmmoLimitsChecker
{
  Inventory.PickupMessage "$GOTCHAINGUN"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    MGUN A -1
    Stop
@BpkGenMoreStates(ChaingunExDropped)
  }
}

actor RocketLauncherEx: RocketLauncher
{
@BpkGenMoreProps(RocketLauncherEx)
}

actor RocketLauncherExThing: @BpkGenAmmoLimitsChecker replaces RocketLauncher
{
  Inventory.PickupMessage "$GOTLAUNCHER"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    LAUN A -1
    Stop
@BpkGenMoreStates(RocketLauncherExThing)
  }
}

actor PlasmaRifleEx: PlasmaRifle
{
@BpkGenMoreProps(PlasmaRifleEx)
}

actor PlasmaRifleExThing: @BpkGenAmmoLimitsChecker replaces PlasmaRifle
{
  Inventory.PickupMessage "$GOTPLASMA"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    PLAS A -1
    Stop
@BpkGenMoreStates(PlasmaRifleExThing)
  }
}

actor BFG9000Ex: BFG9000
{
@BpkGenMoreProps(BFG9000Ex)
}

actor BFG9000ExThing: @BpkGenAmmoLimitsChecker replaces BFG9000
{
  Height 20
  Inventory.PickupMessage "$GOTBFG9000"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    BFUG A -1
    Stop
@BpkGenMoreStates(BFG9000ExThing)
  }
}


//
// monster replacements - these monsters drop weapons
// which give different amount of ammo than default weapons spawned
//

actor ShotgunGuyEx: ShotgunGuy replaces ShotgunGuy {
	DropItem "ShotgunExDropped"
}

actor ChaingunGuyEx: ChaingunGuy replaces ChaingunGuy {
	DropItem "ChaingunExDropped"
}


//
// player classes with suitable starting items and weapon slots
//

actor DoomPlayerEx: DoomPlayer replaces DoomPlayer
{
  Player.StartItem "PistolEx"
  Player.StartItem "Fist"
  Player.StartItem "ClipEx", 50
  Player.WeaponSlot 1, Fist, Chainsaw
  Player.WeaponSlot 2, PistolEx
  Player.WeaponSlot 3, ShotgunEx, SuperShotgunEx
  Player.WeaponSlot 4, ChaingunEx
  Player.WeaponSlot 5, RocketLauncherEx
  Player.WeaponSlot 6, PlasmaRifleEx
  Player.WeaponSlot 7, BFG9000Ex
}
DECORATE produced by the tool from the given template looks like this (AmmoLimitsChecker actor definition is a primary thing to generate here):

Code: Select all

// 
// ammo in player's inventory (real ammo from the POV of zdoom engine)
// 

actor ClipEx: Ammo
{
  Inventory.Icon "CLIPA0"
  Inventory.Amount 1
  Inventory.MaxAmount 200
  Ammo.BackpackAmount 0
  Ammo.BackpackMaxAmount 600
}

actor ShellEx: Ammo
{
  Inventory.Icon "SHELA0"
  Inventory.Amount 1
  Inventory.MaxAmount 50
  Ammo.BackpackAmount 0
  Ammo.BackpackMaxAmount 200
}

actor RocketAmmoEx: Ammo
{
  Inventory.Icon "ROCKA0"
  Inventory.Amount 1
  Inventory.MaxAmount 50
  Ammo.BackpackAmount 0
  Ammo.BackpackMaxAmount 200
}

actor CellEx: Ammo
{
  Inventory.Icon "CELLA0"
  Inventory.Amount 1
  Inventory.MaxAmount 300
  Ammo.BackpackAmount 0
  Ammo.BackpackMaxAmount 920
}


//
// utility classes to check ammo in player's inventory
//

// 
// AmmoLimitsChecker - checks ammo limits are not exceeded when derived by a child
// also, some helper classes for AmmoLimitsChecker
// 

actor BackpackMarker: Inventory
{
  Inventory.MaxAmount 3
}


actor AmmoLimitNotReachedMarker: Inventory
{
  Inventory.MaxAmount 1
}

actor AmmoLimitsChecker: CustomInventory
{
  States
  {
  ClipExCheckLimitStart:
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 3, 6)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 2, 4)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 1, 2)
    Goto ClipExCheckLimitStart+3

    // ClipExCheckLimitStart+3
    TNT1 A 0 A_JumpIfInventory("ClipEx", 200, "ClipExCheckLimitAfter")
    Goto ClipExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("ClipEx", 300, "ClipExCheckLimitAfter")
    Goto ClipExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("ClipEx", 400, "ClipExCheckLimitAfter")
    Goto ClipExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("ClipEx", 600, "ClipExCheckLimitAfter")
    Goto ClipExCheckLimitStart+7

    // ClipExCheckLimitStart+7
    TNT1 A 0 A_GiveInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_Jump(256, "ClipExCheckLimitAfter")
    Stop

  ShellExCheckLimitStart:
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 3, 6)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 2, 4)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 1, 2)
    Goto ShellExCheckLimitStart+3

    // ShellExCheckLimitStart+3
    TNT1 A 0 A_JumpIfInventory("ShellEx", 50, "ShellExCheckLimitAfter")
    Goto ShellExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("ShellEx", 80, "ShellExCheckLimitAfter")
    Goto ShellExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("ShellEx", 100, "ShellExCheckLimitAfter")
    Goto ShellExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("ShellEx", 200, "ShellExCheckLimitAfter")
    Goto ShellExCheckLimitStart+7

    // ShellExCheckLimitStart+7
    TNT1 A 0 A_GiveInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_Jump(256, "ShellExCheckLimitAfter")
    Stop

  RocketAmmoExCheckLimitStart:
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 3, 6)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 2, 4)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 1, 2)
    Goto RocketAmmoExCheckLimitStart+3

    // RocketAmmoExCheckLimitStart+3
    TNT1 A 0 A_JumpIfInventory("RocketAmmoEx", 50, "RocketAmmoExCheckLimitAfter")
    Goto RocketAmmoExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("RocketAmmoEx", 80, "RocketAmmoExCheckLimitAfter")
    Goto RocketAmmoExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("RocketAmmoEx", 100, "RocketAmmoExCheckLimitAfter")
    Goto RocketAmmoExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("RocketAmmoEx", 200, "RocketAmmoExCheckLimitAfter")
    Goto RocketAmmoExCheckLimitStart+7

    // RocketAmmoExCheckLimitStart+7
    TNT1 A 0 A_GiveInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_Jump(256, "RocketAmmoExCheckLimitAfter")
    Stop

  CellExCheckLimitStart:
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 3, 6)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 2, 4)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 1, 2)
    Goto CellExCheckLimitStart+3

    // CellExCheckLimitStart+3
    TNT1 A 0 A_JumpIfInventory("CellEx", 300, "CellExCheckLimitAfter")
    Goto CellExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("CellEx", 480, "CellExCheckLimitAfter")
    Goto CellExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("CellEx", 600, "CellExCheckLimitAfter")
    Goto CellExCheckLimitStart+7
    TNT1 A 0 A_JumpIfInventory("CellEx", 920, "CellExCheckLimitAfter")
    Goto CellExCheckLimitStart+7

    // CellExCheckLimitStart+7
    TNT1 A 0 A_GiveInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_Jump(256, "CellExCheckLimitAfter")
    Stop

  FixUpAmmoStart:
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 3, "FixUpAmmo3")
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 2, "FixUpAmmo2")
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 1, "FixUpAmmo1")
    TNT1 A 0 
    Stop

  FixUpAmmo1:
    TNT1 A 0 A_JumpIfInventory("ClipEx", 301, 5)
    TNT1 A 0 A_JumpIfInventory("ShellEx", 81, 6)
    TNT1 A 0 A_JumpIfInventory("RocketAmmoEx", 81, 7)
    TNT1 A 0 A_JumpIfInventory("CellEx", 481, 8)
    TNT1 A 0 
    Stop

    // fix up 'ClipEx' amount in player's inventory
    TNT1 A 0 A_TakeInventory("ClipEx")
    TNT1 A 0 A_GiveInventory("ClipEx", 300)
    Goto FixUpAmmo1+1

    // fix up 'ShellEx' amount in player's inventory
    TNT1 A 0 A_TakeInventory("ShellEx")
    TNT1 A 0 A_GiveInventory("ShellEx", 80)
    Goto FixUpAmmo1+2

    // fix up 'RocketAmmoEx' amount in player's inventory
    TNT1 A 0 A_TakeInventory("RocketAmmoEx")
    TNT1 A 0 A_GiveInventory("RocketAmmoEx", 80)
    Goto FixUpAmmo1+3

    // fix up 'CellEx' amount in player's inventory
    TNT1 A 0 A_TakeInventory("CellEx")
    TNT1 A 0 A_GiveInventory("CellEx", 480)
    Goto FixUpAmmo1+4

  FixUpAmmo2:
    TNT1 A 0 A_JumpIfInventory("ClipEx", 401, 5)
    TNT1 A 0 A_JumpIfInventory("ShellEx", 101, 6)
    TNT1 A 0 A_JumpIfInventory("RocketAmmoEx", 101, 7)
    TNT1 A 0 A_JumpIfInventory("CellEx", 601, 8)
    TNT1 A 0 
    Stop

    // fix up 'ClipEx' amount in player's inventory
    TNT1 A 0 A_TakeInventory("ClipEx")
    TNT1 A 0 A_GiveInventory("ClipEx", 400)
    Goto FixUpAmmo2+1

    // fix up 'ShellEx' amount in player's inventory
    TNT1 A 0 A_TakeInventory("ShellEx")
    TNT1 A 0 A_GiveInventory("ShellEx", 100)
    Goto FixUpAmmo2+2

    // fix up 'RocketAmmoEx' amount in player's inventory
    TNT1 A 0 A_TakeInventory("RocketAmmoEx")
    TNT1 A 0 A_GiveInventory("RocketAmmoEx", 100)
    Goto FixUpAmmo2+3

    // fix up 'CellEx' amount in player's inventory
    TNT1 A 0 A_TakeInventory("CellEx")
    TNT1 A 0 A_GiveInventory("CellEx", 600)
    Goto FixUpAmmo2+4

  FixUpAmmo3:
    TNT1 A 0 
    Stop
  }
}


// 
// backpack pickups
// 

actor SmallAmmoBag: AmmoLimitsChecker 15000
{
  Inventory.PickupMessage "Picked up a small ammo bag!"

  States
  {
  Spawn:
    BPAK A 0
    BPAK A 0 A_SetScale(0.5, 0.5)
    BPAK A -1
    Stop

  Pickup:
    TNT1 A 0 A_GiveInventory("Backpack", 1)
    TNT1 A 0 A_GiveInventory("ClipEx", 10)
    TNT1 A 0 A_GiveInventory("ShellEx", 4)
    TNT1 A 0 A_GiveInventory("RocketAmmoEx", 1)
    TNT1 A 0 A_GiveInventory("CellEx", 20)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 1, 3)
    TNT1 A 0 A_TakeInventory("BackpackMarker")
    TNT1 A 0 A_GiveInventory("BackpackMarker", 1)
    TNT1 A 0 
    Goto Super::FixUpAmmoStart
  }
}

actor BackpackEx: AmmoLimitsChecker replaces Backpack
{
  Height 26
  Inventory.PickupMessage "$GOTBACKPACK"

  States
  {
  Spawn:
    BPAK A -1
    Stop

  Pickup:
    TNT1 A 0 A_GiveInventory("Backpack", 1)
    TNT1 A 0 A_GiveInventory("ClipEx", 20)
    TNT1 A 0 A_GiveInventory("ShellEx", 8)
    TNT1 A 0 A_GiveInventory("RocketAmmoEx", 2)
    TNT1 A 0 A_GiveInventory("CellEx", 40)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 2, 3)
    TNT1 A 0 A_TakeInventory("BackpackMarker")
    TNT1 A 0 A_GiveInventory("BackpackMarker", 2)
    TNT1 A 0 
    Goto Super::FixUpAmmoStart
  }
}

actor HeavyBackpack: AmmoLimitsChecker 15001
{
  Height 30
  Inventory.PickupMessage "A heavy backpack! For some heavy ammo amounts!"

  States
  {
  Spawn:
    BPAK A 0
    BPAK A 0 A_SetScale(1.3, 1.3)
    BPAK A 0 A_FadeOut(0.3)
  FadingLoop:
    BPAK A 10 A_FadeOut(0.1)
    BPAK A 10 A_FadeOut(0.1)
    BPAK A 10 A_FadeOut(0.1)
    BPAK A 10 A_FadeOut(0.1)
    BPAK A 10 A_FadeIn(0.1)
    BPAK A 10 A_FadeIn(0.1)
    BPAK A 10 A_FadeIn(0.1)
    BPAK A 30 Bright A_FadeIn(0.1)
    Loop

  Pickup:
    TNT1 A 0 A_GiveInventory("Backpack", 1)
    TNT1 A 0 A_GiveInventory("ClipEx", 50)
    TNT1 A 0 A_GiveInventory("ShellEx", 20)
    TNT1 A 0 A_GiveInventory("RocketAmmoEx", 5)
    TNT1 A 0 A_GiveInventory("CellEx", 100)
    TNT1 A 0 A_JumpIfInventory("BackpackMarker", 3, 3)
    TNT1 A 0 A_TakeInventory("BackpackMarker")
    TNT1 A 0 A_GiveInventory("BackpackMarker", 3)
    TNT1 A 0 
    Goto Super::FixUpAmmoStart
  }
}


// 
// ammo pickups
// 

actor SingleClipEx: AmmoLimitsChecker replaces Clip
{
  Inventory.PickupMessage "$GOTCLIP"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    CLIP A -1
    Stop

  Pickup:
    TNT1 A 0 
    Goto Super::ClipExCheckLimitStart

  ClipExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("ClipEx", 10)
    Goto Super::FixUpAmmoStart
  }
}

actor SomeShellsEx: AmmoLimitsChecker replaces Shell
{
  Inventory.PickupMessage "$GOTSHELLS"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    SHEL A -1
    Stop

  Pickup:
    TNT1 A 0 
    Goto Super::ShellExCheckLimitStart

  ShellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("ShellEx", 4)
    Goto Super::FixUpAmmoStart
  }
}

actor SingleRocketEx: AmmoLimitsChecker replaces RocketAmmo
{
  Inventory.PickupMessage "$GOTROCKET"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    ROCK A -1
    Stop

  Pickup:
    TNT1 A 0 
    Goto Super::RocketAmmoExCheckLimitStart

  RocketAmmoExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("RocketAmmoEx", 1)
    Goto Super::FixUpAmmoStart
  }
}

actor SmallCellBoxEx: AmmoLimitsChecker replaces Cell
{
  Inventory.PickupMessage "$GOTCELL"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    CELL A -1
    Stop

  Pickup:
    TNT1 A 0 
    Goto Super::CellExCheckLimitStart

  CellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("CellEx", 20)
    Goto Super::FixUpAmmoStart
  }
}

actor ClipBoxEx: AmmoLimitsChecker replaces ClipBox
{
  Inventory.PickupMessage "$GOTCLIPBOX"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    AMMO A -1
    Stop

  Pickup:
    TNT1 A 0 
    Goto Super::ClipExCheckLimitStart

  ClipExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("ClipEx", 50)
    Goto Super::FixUpAmmoStart
  }
}

actor ShellBoxEx: AmmoLimitsChecker replaces ShellBox
{
  Inventory.PickupMessage "$GOTSHELLBOX"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    SBOX A -1
    Stop

  Pickup:
    TNT1 A 0 
    Goto Super::ShellExCheckLimitStart

  ShellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("ShellEx", 20)
    Goto Super::FixUpAmmoStart
  }
}

actor RocketBoxEx: AmmoLimitsChecker replaces RocketBox
{
  Inventory.PickupMessage "$GOTROCKBOX"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    BROK A -1
    Stop

  Pickup:
    TNT1 A 0 
    Goto Super::RocketAmmoExCheckLimitStart

  RocketAmmoExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("RocketAmmoEx", 5)
    Goto Super::FixUpAmmoStart
  }
}

actor CellPackEx: AmmoLimitsChecker replaces CellPack
{
  Inventory.PickupMessage "$GOTCELLBOX"
  Inventory.PickupSound "misc/ammo_pkup"

  States
  {
  Spawn:
    CELP A -1
    Stop

  Pickup:
    TNT1 A 0 
    Goto Super::CellExCheckLimitStart

  CellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("CellEx", 100)
    Goto Super::FixUpAmmoStart
  }
}


//
// weapons (only those which use ammo)
// need two separated actors for each weapon:
// 1) a custom inventory, which supports 'Pickup' state - derived from ammo limits checking class
// 2) a weapon itself - those are real weapons from the POV of zdoom engine
//

actor PistolEx: Pistol
{
  Weapon.AmmoType "ClipEx"
  Weapon.AmmoGive 0
}

actor PistolExThing: AmmoLimitsChecker replaces Pistol
{
  Inventory.PickupMessage "$PICKUP_PISTOL_DROPPED"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    PIST A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("PistolEx", 1, "Super::ClipExCheckLimitStart")
    Goto ActualPickup

  ClipExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("PistolEx")
    TNT1 A 0 A_GiveInventory("ClipEx", 20)
    Goto Super::FixUpAmmoStart
  }
}

actor ShotgunEx: Shotgun
{
  Weapon.AmmoType "ShellEx"
  Weapon.AmmoGive 0
}

actor ShotgunExThing: AmmoLimitsChecker replaces Shotgun
{
  Inventory.PickupMessage "$GOTSHOTGUN"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    SHOT A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("ShotgunEx", 1, "Super::ShellExCheckLimitStart")
    Goto ActualPickup

  ShellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("ShotgunEx")
    TNT1 A 0 A_GiveInventory("ShellEx", 8)
    Goto Super::FixUpAmmoStart
  }
}

actor ShotgunExDropped: AmmoLimitsChecker
{
  Inventory.PickupMessage "$GOTSHOTGUN"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    SHOT A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("ShotgunEx", 1, "Super::ShellExCheckLimitStart")
    Goto ActualPickup

  ShellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("ShotgunEx")
    TNT1 A 0 A_GiveInventory("ShellEx", 4)
    Goto Super::FixUpAmmoStart
  }
}

actor SuperShotgunEx: SuperShotgun
{
  Weapon.AmmoType "ShellEx"
  Weapon.AmmoGive 0
}

actor SuperShotgunExThing: AmmoLimitsChecker replaces SuperShotgun
{
  Inventory.PickupMessage "$GOTSHOTGUN2"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    SGN2 A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("SuperShotgunEx", 1, "Super::ShellExCheckLimitStart")
    Goto ActualPickup

  ShellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("SuperShotgunEx")
    TNT1 A 0 A_GiveInventory("ShellEx", 8)
    Goto Super::FixUpAmmoStart
  }
}

actor ChaingunEx: Chaingun
{
  Weapon.AmmoType "ClipEx"
  Weapon.AmmoGive 0
}

actor ChaingunExThing: AmmoLimitsChecker replaces Chaingun
{
  Inventory.PickupMessage "$GOTCHAINGUN"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    MGUN A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("ChaingunEx", 1, "Super::ClipExCheckLimitStart")
    Goto ActualPickup

  ClipExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("ChaingunEx")
    TNT1 A 0 A_GiveInventory("ClipEx", 20)
    Goto Super::FixUpAmmoStart
  }
}

actor ChaingunExDropped: AmmoLimitsChecker
{
  Inventory.PickupMessage "$GOTCHAINGUN"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    MGUN A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("ChaingunEx", 1, "Super::ClipExCheckLimitStart")
    Goto ActualPickup

  ClipExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("ChaingunEx")
    TNT1 A 0 A_GiveInventory("ClipEx", 10)
    Goto Super::FixUpAmmoStart
  }
}

actor RocketLauncherEx: RocketLauncher
{
  Weapon.AmmoType "RocketAmmoEx"
  Weapon.AmmoGive 0
}

actor RocketLauncherExThing: AmmoLimitsChecker replaces RocketLauncher
{
  Inventory.PickupMessage "$GOTLAUNCHER"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    LAUN A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("RocketLauncherEx", 1, "Super::RocketAmmoExCheckLimitStart")
    Goto ActualPickup

  RocketAmmoExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("RocketLauncherEx")
    TNT1 A 0 A_GiveInventory("RocketAmmoEx", 2)
    Goto Super::FixUpAmmoStart
  }
}

actor PlasmaRifleEx: PlasmaRifle
{
  Weapon.AmmoType "CellEx"
  Weapon.AmmoGive 0
}

actor PlasmaRifleExThing: AmmoLimitsChecker replaces PlasmaRifle
{
  Inventory.PickupMessage "$GOTPLASMA"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    PLAS A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("PlasmaRifleEx", 1, "Super::CellExCheckLimitStart")
    Goto ActualPickup

  CellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("PlasmaRifleEx")
    TNT1 A 0 A_GiveInventory("CellEx", 40)
    Goto Super::FixUpAmmoStart
  }
}

actor BFG9000Ex: BFG9000
{
  Weapon.AmmoType "CellEx"
  Weapon.AmmoGive 0
}

actor BFG9000ExThing: AmmoLimitsChecker replaces BFG9000
{
  Height 20
  Inventory.PickupMessage "$GOTBFG9000"
  Inventory.PickupSound "misc/w_pkup"
  +WEAPONSPAWN

  States
  {
  Spawn:
    BFUG A -1
    Stop

  Pickup:
    TNT1 A 0 A_JumpIfInventory("BFG9000Ex", 1, "Super::CellExCheckLimitStart")
    Goto ActualPickup

  CellExCheckLimitAfter:
    TNT1 A 0 A_JumpIfInventory("AmmoLimitNotReachedMarker", 1, "ActualPickup")
    Fail

  ActualPickup:
    TNT1 A 0 A_TakeInventory("AmmoLimitNotReachedMarker")
    TNT1 A 0 A_GiveInventory("BFG9000Ex")
    TNT1 A 0 A_GiveInventory("CellEx", 40)
    Goto Super::FixUpAmmoStart
  }
}


//
// monster replacements - these monsters drop weapons
// which give different amount of ammo than default weapons spawned
//

actor ShotgunGuyEx: ShotgunGuy replaces ShotgunGuy {
	DropItem "ShotgunExDropped"
}

actor ChaingunGuyEx: ChaingunGuy replaces ChaingunGuy {
	DropItem "ChaingunExDropped"
}


//
// player classes with suitable starting items and weapon slots
//

actor DoomPlayerEx: DoomPlayer replaces DoomPlayer
{
  Player.StartItem "PistolEx"
  Player.StartItem "Fist"
  Player.StartItem "ClipEx", 50
  Player.WeaponSlot 1, Fist, Chainsaw
  Player.WeaponSlot 2, PistolEx
  Player.WeaponSlot 3, ShotgunEx, SuperShotgunEx
  Player.WeaponSlot 4, ChaingunEx
  Player.WeaponSlot 5, RocketLauncherEx
  Player.WeaponSlot 6, PlasmaRifleEx
  Player.WeaponSlot 7, BFG9000Ex
}
Post Reply

Return to “Creation, Conversion, and Editing”