- Added A_WeaponOffset(x = 0, y = 32, flags).
- Places the weapon offset by the defined x and y. Both are floats. This stacks with weapon bobbing. - WOF_KEEPX: Don't change the X offset. - WOF_KEEPY: Don't change the Y offset. - WOF_ADD: Add onto instead of replacing the coordinates.
This commit is contained in:
parent
661c2e5919
commit
115dbd0b58
3 changed files with 66 additions and 0 deletions
|
|
@ -783,6 +783,63 @@ DEFINE_ACTION_FUNCTION(AInventory, A_CheckReload)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC A_WeaponOffset
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
enum WOFFlags
|
||||
{
|
||||
WOF_KEEPX = 1,
|
||||
WOF_KEEPY = 1 << 1,
|
||||
WOF_ADD = 1 << 2,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_WeaponOffset)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_FLOAT_OPT(wx) { wx = 0.; }
|
||||
PARAM_FLOAT_OPT(wy) { wy = 32.; }
|
||||
PARAM_INT_OPT(flags) { flags = 0; }
|
||||
|
||||
if ((flags & WOF_KEEPX) && (flags & WOF_KEEPY))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
player_t *player = self->player;
|
||||
pspdef_t *psp;
|
||||
|
||||
if (player && (player->playerstate != PST_DEAD))
|
||||
{
|
||||
psp = &player->psprites[ps_weapon];
|
||||
if (!(flags & WOF_KEEPX))
|
||||
{
|
||||
if (flags & WOF_ADD)
|
||||
{
|
||||
psp->sx += wx;
|
||||
}
|
||||
else
|
||||
{
|
||||
psp->sx = wx;
|
||||
}
|
||||
}
|
||||
if (!(flags & WOF_KEEPY))
|
||||
{
|
||||
if (flags & WOF_ADD)
|
||||
{
|
||||
psp->sy += wy;
|
||||
}
|
||||
else
|
||||
{
|
||||
psp->sy = wy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC A_Lower
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue