- Duke: Move PlayerUseItem() wrapper into DDukePlayer.

* Regex used: `PlayerUseItem\(\w+\,\s?(\w+)\)` -> `p->itemUsed($1)`.
This commit is contained in:
Mitchell Richters 2023-10-03 19:27:33 +11:00
parent 0d25bbe84a
commit ab47cf185e
3 changed files with 11 additions and 11 deletions

View file

@ -111,11 +111,6 @@ inline void PlayerSetItemUsed(int pl, int num)
getPlayer(pl)->cmd.ucmd.setItemUsed(num - 1);
}
inline bool PlayerUseItem(int pl, int num)
{
return getPlayer(pl)->cmd.ucmd.isItemUsed(num - 1);
}
inline void clearfriction()
{
for (int i = 0; i != -1; i = connectpoint2[i])

View file

@ -129,7 +129,7 @@ void hud_input(int plnum)
}
}
if (!isRR() && PlayerUseItem(plnum, ICON_HEATS))
if (!isRR() && p->itemUsed(ICON_HEATS))
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_USENIGHTVISION, plnum, nullptr, -1);
@ -142,7 +142,7 @@ void hud_input(int plnum)
}
}
if (PlayerUseItem(plnum, ICON_STEROIDS))
if (p->itemUsed(ICON_STEROIDS))
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_USESTEROIDS, plnum, nullptr, -1);
@ -269,7 +269,7 @@ void hud_input(int plnum)
}
}
if (PlayerUseItem(plnum, ICON_HOLODUKE) && (isRR() || p->newOwner == nullptr))
if (p->itemUsed(ICON_HOLODUKE) && (isRR() || p->newOwner == nullptr))
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_HOLODUKEON, plnum, nullptr, -1);
@ -323,7 +323,7 @@ void hud_input(int plnum)
}
}
if (isRR() && PlayerUseItem(plnum, ICON_HEATS) && p->newOwner == nullptr)
if (isRR() && p->itemUsed(ICON_HEATS) && p->newOwner == nullptr)
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_USENIGHTVISION, plnum, nullptr, -1);
@ -355,7 +355,7 @@ void hud_input(int plnum)
}
}
if (PlayerUseItem(plnum, ICON_FIRSTAID))
if (p->itemUsed(ICON_FIRSTAID))
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_USEMEDKIT, plnum, nullptr, -1);
@ -408,7 +408,7 @@ void hud_input(int plnum)
}
}
if (PlayerUseItem(plnum, ICON_JETPACK) && (isRR() || p->newOwner == nullptr))
if (p->itemUsed(ICON_JETPACK) && (isRR() || p->newOwner == nullptr))
{
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
OnEvent(EVENT_USEJETPACK, plnum, nullptr, -1);

View file

@ -399,6 +399,11 @@ public:
{
Angles.doViewPitch(aim_mode == 0 && on_ground && cursector->lotag != ST_2_UNDERWATER);
}
inline bool itemUsed(int num)
{
return cmd.ucmd.isItemUsed(num - 1);
}
};
struct Cycler