- Apply patch to prevent the flash state from being processed twice after using A_GunFlash.

SVN r3500 (trunk)
This commit is contained in:
Randy Heit 2012-04-01 02:49:04 +00:00
parent d9f7a250ba
commit 19ec79d4f3
3 changed files with 32 additions and 1 deletions

View file

@ -28,6 +28,7 @@
#include "thingdef/thingdef.h"
#include "g_level.h"
#include "farchive.h"
#include "d_player.h"
// MACROS ------------------------------------------------------------------
@ -58,6 +59,30 @@ static FRandom pr_gunshot ("GunShot");
// CODE --------------------------------------------------------------------
//---------------------------------------------------------------------------
//
// PROC P_NewPspriteTick
//
//---------------------------------------------------------------------------
void P_NewPspriteTick()
{
// This function should be called after the beginning of a tick, before any possible
// prprite-event, or near the end, after any possible psprite event.
// Because data is reset for every tick (which it must be) this has no impact on savegames.
for (int i = 0; i<MAXPLAYERS; i++)
{
if (playeringame[i])
{
pspdef_t *pspdef = players[i].psprites;
for (int j = 0;j < NUMPSPRITES; j++)
{
pspdef[j].processPending = true;
}
}
}
}
//---------------------------------------------------------------------------
//
// PROC P_SetPsprite
@ -74,6 +99,8 @@ void P_SetPsprite (player_t *player, int position, FState *state, bool nofunctio
}
psp = &player->psprites[position];
psp->processPending = false; // Do not subsequently perform periodic processing within the same tick.
do
{
if (state == NULL)
@ -837,7 +864,7 @@ void P_MovePsprites (player_t *player)
psp = &player->psprites[0];
for (i = 0; i < NUMPSPRITES; i++, psp++)
{
if ((state = psp->state) != NULL) // a null state means not active
if ((state = psp->state) != NULL && psp->processPending) // a null state means not active
{
// drop tic count and possibly change state
if (psp->tics != -1) // a -1 tic count never changes

View file

@ -70,6 +70,7 @@ struct pspdef_t
fixed_t sy;
int sprite;
int frame;
bool processPending; // true: waiting for periodic processing on this tick
};
class FArchive;
@ -80,6 +81,7 @@ class player_t;
class AActor;
struct FState;
void P_NewPspriteTick();
void P_SetPsprite (player_t *player, int position, FState *state, bool nofunction=false);
void P_CalcSwing (player_t *player);
void P_BringUpWeapon (player_t *player);

View file

@ -84,6 +84,8 @@ void P_Ticker (void)
if (paused || P_CheckTickerPaused())
return;
P_NewPspriteTick();
// [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer().
if ((level.time & 3) == 0)
{