mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 03:52:12 -04:00
macroize the weapon state checks in P_MovePsprites()
This commit is contained in:
parent
6721c93497
commit
d912403233
21
src/p_pspr.c
21
src/p_pspr.c
@ -1087,22 +1087,23 @@ void P_MovePsprites(player_t *player)
|
|||||||
winfo = &weaponinfo[player->readyweapon];
|
winfo = &weaponinfo[player->readyweapon];
|
||||||
state = psp->state - states;
|
state = psp->state - states;
|
||||||
|
|
||||||
|
#define LOWERING (psp->state->action.p2 == (actionf_p2)A_Lower || \
|
||||||
|
state == winfo->downstate)
|
||||||
|
#define RAISING (psp->state->action.p2 == (actionf_p2)A_Raise || \
|
||||||
|
state == winfo->upstate)
|
||||||
|
|
||||||
if (psp->state && !cosmetic_bobbing)
|
if (psp->state && !cosmetic_bobbing)
|
||||||
{
|
{
|
||||||
static fixed_t last_sy = WEAPONTOP;
|
static fixed_t last_sy = WEAPONTOP;
|
||||||
|
|
||||||
psp->sx2 = FRACUNIT;
|
psp->sx2 = FRACUNIT;
|
||||||
|
|
||||||
if (!psp->state->misc1 &&
|
if (!psp->state->misc1 && !LOWERING && !RAISING)
|
||||||
psp->state->action.p2 != (actionf_p2)A_Lower &&
|
|
||||||
psp->state->action.p2 != (actionf_p2)A_Raise &&
|
|
||||||
state != winfo->downstate && state != winfo->upstate)
|
|
||||||
{
|
{
|
||||||
last_sy = psp->sy2;
|
last_sy = psp->sy2;
|
||||||
psp->sy2 = WEAPONTOP;
|
psp->sy2 = WEAPONTOP;
|
||||||
}
|
}
|
||||||
else if (psp->state->action.p2 == (actionf_p2)A_Lower ||
|
else if (LOWERING)
|
||||||
state == winfo->downstate)
|
|
||||||
{
|
{
|
||||||
// We want to move smoothly from where we were
|
// We want to move smoothly from where we were
|
||||||
psp->sy2 -= (last_sy - WEAPONTOP);
|
psp->sy2 -= (last_sy - WEAPONTOP);
|
||||||
@ -1111,10 +1112,7 @@ void P_MovePsprites(player_t *player)
|
|||||||
else if (psp->state && (cosmetic_bobbing == BOBBING_75 || center_weapon || uncapped))
|
else if (psp->state && (cosmetic_bobbing == BOBBING_75 || center_weapon || uncapped))
|
||||||
{
|
{
|
||||||
// [FG] don't center during lowering and raising states
|
// [FG] don't center during lowering and raising states
|
||||||
if (psp->state->misc1 ||
|
if (psp->state->misc1 || LOWERING || RAISING)
|
||||||
psp->state->action.p2 == (actionf_p2)A_Lower ||
|
|
||||||
psp->state->action.p2 == (actionf_p2)A_Raise ||
|
|
||||||
state == winfo->downstate || state == winfo->upstate)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// [FG] not attacking means idle
|
// [FG] not attacking means idle
|
||||||
@ -1130,6 +1128,9 @@ void P_MovePsprites(player_t *player)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef LOWERING
|
||||||
|
#undef RAISING
|
||||||
|
|
||||||
player->psprites[ps_flash].sx2 = player->psprites[ps_weapon].sx2;
|
player->psprites[ps_flash].sx2 = player->psprites[ps_weapon].sx2;
|
||||||
player->psprites[ps_flash].sy2 = player->psprites[ps_weapon].sy2;
|
player->psprites[ps_flash].sy2 = player->psprites[ps_weapon].sy2;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user