Navigation Menu

Skip to content

Commit

Permalink
- Apply patch to prevent the flash state from being processed twice a…
Browse files Browse the repository at this point in the history
…fter using A_GunFlash.

SVN r3500 (trunk)
  • Loading branch information
Randy Heit committed Apr 1, 2012
1 parent d9f7a25 commit 19ec79d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/p_pspr.cpp
Expand Up @@ -28,6 +28,7 @@
#include "thingdef/thingdef.h"
#include "g_level.h"
#include "farchive.h"
#include "d_player.h"


// MACROS ------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/p_pspr.h
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/p_tick.cpp
Expand Up @@ -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)
{
Expand Down

0 comments on commit 19ec79d

Please sign in to comment.