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