mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
Small refactor
This commit is contained in:
parent
b220db4ebe
commit
8f360f3bea
3 changed files with 31 additions and 31 deletions
|
@ -531,8 +531,8 @@ public:
|
|||
// PSprite layers
|
||||
void TickPSprites();
|
||||
void DestroyPSprites();
|
||||
DPSprite *GetPSprite(psprnum_t layer); // Used ONLY for compatibility with the old hardcoded layers.
|
||||
DPSprite *FindPSprite(int layer);
|
||||
DPSprite *GetPSprite(psprnum_t layer); // Used ONLY for compatibility with the old hardcoded layers.
|
||||
};
|
||||
|
||||
// Bookkeeping on players - state.
|
||||
|
|
|
@ -128,7 +128,7 @@ DPSprite::DPSprite(player_t *owner, AInventory *caller, int id)
|
|||
}
|
||||
Next = next;
|
||||
GC::WriteBarrier(this, next);
|
||||
if (prev == NULL)
|
||||
if (prev == nullptr)
|
||||
{
|
||||
Owner->psprites = this;
|
||||
GC::WriteBarrier(this);
|
||||
|
@ -149,6 +149,29 @@ DPSprite::DPSprite(player_t *owner, AInventory *caller, int id)
|
|||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
DPSprite *player_t::FindPSprite(int layer)
|
||||
{
|
||||
if (layer == 0)
|
||||
return nullptr;
|
||||
|
||||
DPSprite *pspr = psprites;
|
||||
while (pspr)
|
||||
{
|
||||
if (pspr->ID == layer)
|
||||
break;
|
||||
|
||||
pspr = pspr->Next;
|
||||
}
|
||||
|
||||
return pspr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
DPSprite *player_t::GetPSprite(psprnum_t layer)
|
||||
{
|
||||
assert(layer > 0 && layer < NUMPSPRITES);
|
||||
|
@ -177,29 +200,6 @@ DPSprite *player_t::GetPSprite(psprnum_t layer)
|
|||
return pspr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
DPSprite *player_t::FindPSprite(int layer)
|
||||
{
|
||||
if (layer == 0)
|
||||
return nullptr;
|
||||
|
||||
DPSprite *pspr = psprites;
|
||||
while (pspr)
|
||||
{
|
||||
if (pspr->ID == layer)
|
||||
break;
|
||||
|
||||
pspr = pspr->Next;
|
||||
}
|
||||
|
||||
return pspr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC P_NewPspriteTick
|
||||
|
|
12
src/p_pspr.h
12
src/p_pspr.h
|
@ -62,12 +62,12 @@ public:
|
|||
static void NewTick();
|
||||
void SetState(FState *newstate, bool pending = false);
|
||||
|
||||
int GetID() const { return ID; }
|
||||
int GetSprite() const { return Sprite; }
|
||||
int GetFrame() const { return Frame; }
|
||||
FState* GetState() const { return State; }
|
||||
DPSprite* GetNext() { return Next; }
|
||||
AInventory* GetCaller() { return Caller; }
|
||||
int GetID() const { return ID; }
|
||||
int GetSprite() const { return Sprite; }
|
||||
int GetFrame() const { return Frame; }
|
||||
FState* GetState() const { return State; }
|
||||
DPSprite* GetNext() { return Next; }
|
||||
AInventory* GetCaller() { return Caller; }
|
||||
|
||||
double x, y;
|
||||
double oldx, oldy;
|
||||
|
|
Loading…
Reference in a new issue