- Sync scripting branch with what was in trunk on Sunday. I believe that would be revision 2739.

SVN r2790 (scripting)
This commit is contained in:
Randy Heit 2010-09-16 03:14:32 +00:00
commit 99670b708c
317 changed files with 17299 additions and 7273 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);
}
@ -81,6 +80,19 @@ void P_SetPsprite (player_t *player, int position, FState *state)
}
psp->state = state;
if (state->sprite != SPR_FIXED)
{ // okay to change sprite and/or frame
if (!state->GetSameFrame())
{ // okay to change frame
psp->frame = state->GetFrame();
}
if (state->sprite != SPR_NOCHANGE)
{ // okay to change sprite
psp->sprite = state->sprite;
}
}
if (sv_fastweapons >= 2 && position == ps_weapon)
psp->tics = state->ActionFunc == NULL? 0 : 1;
else if (sv_fastweapons)
@ -97,7 +109,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 +124,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
@ -914,5 +892,15 @@ void P_MovePsprites (player_t *player)
FArchive &operator<< (FArchive &arc, pspdef_t &def)
{
return arc << def.state << def.tics << def.sx << def.sy;
arc << def.state << def.tics << def.sx << def.sy;
if (SaveVersion >= 2295)
{
arc << def.sprite << def.frame;
}
else
{
def.sprite = def.state->sprite;
def.frame = def.state->Frame;
}
return arc;
}