- Merged SetState and SetStateNF into a single function.

- Added new sprite #### and frame character # to specify the behavior of sprite ---- on a
  per-sprite and per-frame basis respectively.

SVN r2291 (trunk)
This commit is contained in:
Randy Heit 2010-04-19 02:46:50 +00:00
commit 178587fff2
15 changed files with 85 additions and 160 deletions

View file

@ -61,13 +61,12 @@ static FRandom pr_gunshot ("GunShot");
//
//---------------------------------------------------------------------------
void P_SetPsprite (player_t *player, int position, FState *state)
void P_SetPsprite (player_t *player, int position, FState *state, bool nofunction)
{
pspdef_t *psp;
if (position == ps_weapon)
{
// A_WeaponReady will re-set these as needed
if (position == ps_weapon && !nofunction)
{ // A_WeaponReady will re-set these as needed
player->cheats &= ~(CF_WEAPONREADY | CF_WEAPONREADYALT | CF_WEAPONBOBBING | CF_WEAPONSWITCHOK);
}
@ -97,7 +96,7 @@ void P_SetPsprite (player_t *player, int position, FState *state)
psp->sy = state->GetMisc2()<<FRACBITS;
}
if (player->mo != NULL)
if (!nofunction && player->mo != NULL)
{
if (state->CallAction(player->mo, player->ReadyWeapon))
{
@ -112,40 +111,6 @@ void P_SetPsprite (player_t *player, int position, FState *state)
} while (!psp->tics); // An initial state of 0 could cycle through.
}
//---------------------------------------------------------------------------
//
// PROC P_SetPspriteNF
//
// Identical to P_SetPsprite, without calling the action function
//---------------------------------------------------------------------------
void P_SetPspriteNF (player_t *player, int position, FState *state)
{
pspdef_t *psp;
psp = &player->psprites[position];
do
{
if (state == NULL)
{ // Object removed itself.
psp->state = NULL;
break;
}
psp->state = state;
psp->tics = state->GetTics(); // could be 0
if (state->GetMisc1())
{ // Set coordinates.
psp->sx = state->GetMisc1()<<FRACBITS;
}
if (state->GetMisc2())
{
psp->sy = state->GetMisc2()<<FRACBITS;
}
state = psp->state->GetNextState();
} while (!psp->tics); // An initial state of 0 could cycle through.
}
//---------------------------------------------------------------------------
//
// PROC P_BringUpWeapon