mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 12:11:25 +00:00
Add inventory virtuals for weapon selection
This commit is contained in:
parent
04cdbd1898
commit
362100fcf0
3 changed files with 71 additions and 4 deletions
|
@ -315,7 +315,7 @@ CCMD (slot)
|
|||
if (slot < NUM_WEAPON_SLOTS && mo)
|
||||
{
|
||||
// Needs to be redone
|
||||
IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickWeapon)
|
||||
IFVM(PlayerPawn, FindWeapon)
|
||||
{
|
||||
VMValue param[] = { mo, slot, !(dmflags2 & DF2_DONTCHECKAMMO) };
|
||||
VMReturn ret((void**)&SendItemUse);
|
||||
|
@ -367,7 +367,7 @@ CCMD (weapnext)
|
|||
if (mo)
|
||||
{
|
||||
// Needs to be redone
|
||||
IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickNextWeapon)
|
||||
IFVM(PlayerPawn, FindNextWeapon)
|
||||
{
|
||||
VMValue param[] = { mo };
|
||||
VMReturn ret((void**)&SendItemUse);
|
||||
|
@ -394,7 +394,7 @@ CCMD (weapprev)
|
|||
if (mo)
|
||||
{
|
||||
// Needs to be redone
|
||||
IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickPrevWeapon)
|
||||
IFVM(PlayerPawn, FindPrevWeapon)
|
||||
{
|
||||
VMValue param[] = { mo };
|
||||
VMReturn ret((void**)&SendItemUse);
|
||||
|
|
|
@ -1366,7 +1366,20 @@ class Inventory : Actor
|
|||
}
|
||||
}
|
||||
|
||||
virtual Weapon ModifyPickWeapon(int slot, bool checkammo, Weapon originalPick)
|
||||
{
|
||||
return originalPick;
|
||||
}
|
||||
|
||||
virtual Weapon ModifyPickNextWeapon(Weapon originalPick)
|
||||
{
|
||||
return originalPick;
|
||||
}
|
||||
|
||||
virtual Weapon ModifyPickPrevWeapon(Weapon originalPick)
|
||||
{
|
||||
return originalPick;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2334,6 +2334,24 @@ class PlayerPawn : Actor
|
|||
return ReadyWeapon;
|
||||
}
|
||||
|
||||
Weapon CallModifyPickWeapon(int slot, bool checkammo, Weapon pick)
|
||||
{
|
||||
let cur = inv;
|
||||
|
||||
if(cur) do
|
||||
{
|
||||
pick = cur.ModifyPickWeapon(slot, checkammo, pick);
|
||||
}
|
||||
while(cur = cur.inv)
|
||||
|
||||
return pick;
|
||||
}
|
||||
|
||||
Weapon FindWeapon(int slot, bool checkammo)
|
||||
{
|
||||
return CallModifyPickWeapon(slot, checkammo, PickWeapon(slot, checkammo));
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FindMostRecentWeapon
|
||||
|
@ -2438,6 +2456,24 @@ class PlayerPawn : Actor
|
|||
return ReadyWeapon;
|
||||
}
|
||||
|
||||
Weapon CallModifyPickNextWeapon(Weapon pick)
|
||||
{
|
||||
let cur = inv;
|
||||
|
||||
if(cur) do
|
||||
{
|
||||
pick = cur.ModifyPickNextWeapon(pick);
|
||||
}
|
||||
while(cur = cur.inv)
|
||||
|
||||
return pick;
|
||||
}
|
||||
|
||||
Weapon FindNextWeapon()
|
||||
{
|
||||
return CallModifyPickNextWeapon(PickNextWeapon());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FWeaponSlots :: PickPrevWeapon
|
||||
|
@ -2491,6 +2527,24 @@ class PlayerPawn : Actor
|
|||
return player.ReadyWeapon;
|
||||
}
|
||||
|
||||
Weapon CallModifyPickPrevWeapon(Weapon pick)
|
||||
{
|
||||
let cur = inv;
|
||||
|
||||
if(cur) do
|
||||
{
|
||||
pick = cur.ModifyPickPrevWeapon(pick);
|
||||
}
|
||||
while(cur = cur.inv)
|
||||
|
||||
return pick;
|
||||
}
|
||||
|
||||
Weapon FindPrevWeapon()
|
||||
{
|
||||
return CallModifyPickPrevWeapon(PickPrevWeapon());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// P_BobWeapon
|
||||
|
|
Loading…
Reference in a new issue