mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-16 17:21:10 +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)
|
if (slot < NUM_WEAPON_SLOTS && mo)
|
||||||
{
|
{
|
||||||
// Needs to be redone
|
// Needs to be redone
|
||||||
IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickWeapon)
|
IFVM(PlayerPawn, FindWeapon)
|
||||||
{
|
{
|
||||||
VMValue param[] = { mo, slot, !(dmflags2 & DF2_DONTCHECKAMMO) };
|
VMValue param[] = { mo, slot, !(dmflags2 & DF2_DONTCHECKAMMO) };
|
||||||
VMReturn ret((void**)&SendItemUse);
|
VMReturn ret((void**)&SendItemUse);
|
||||||
|
@ -367,7 +367,7 @@ CCMD (weapnext)
|
||||||
if (mo)
|
if (mo)
|
||||||
{
|
{
|
||||||
// Needs to be redone
|
// Needs to be redone
|
||||||
IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickNextWeapon)
|
IFVM(PlayerPawn, FindNextWeapon)
|
||||||
{
|
{
|
||||||
VMValue param[] = { mo };
|
VMValue param[] = { mo };
|
||||||
VMReturn ret((void**)&SendItemUse);
|
VMReturn ret((void**)&SendItemUse);
|
||||||
|
@ -394,7 +394,7 @@ CCMD (weapprev)
|
||||||
if (mo)
|
if (mo)
|
||||||
{
|
{
|
||||||
// Needs to be redone
|
// Needs to be redone
|
||||||
IFVIRTUALPTRNAME(mo, NAME_PlayerPawn, PickPrevWeapon)
|
IFVM(PlayerPawn, FindPrevWeapon)
|
||||||
{
|
{
|
||||||
VMValue param[] = { mo };
|
VMValue param[] = { mo };
|
||||||
VMReturn ret((void**)&SendItemUse);
|
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;
|
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
|
// FindMostRecentWeapon
|
||||||
|
@ -2438,6 +2456,24 @@ class PlayerPawn : Actor
|
||||||
return ReadyWeapon;
|
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
|
// FWeaponSlots :: PickPrevWeapon
|
||||||
|
@ -2491,6 +2527,24 @@ class PlayerPawn : Actor
|
||||||
return player.ReadyWeapon;
|
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
|
// P_BobWeapon
|
||||||
|
|
Loading…
Reference in a new issue