mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
remove bool Element::elementActive, use _hidden instead
Element is always alone, never has parent or children, and can use the normal RenderObject::_hidden logic to determine visibility and update calls.
This commit is contained in:
parent
76b391e1fc
commit
3ba31b6aa0
2 changed files with 6 additions and 10 deletions
|
@ -40,7 +40,6 @@ ElementEffectData::ElementEffectData()
|
|||
Element::Element() : Quad()
|
||||
{
|
||||
elementFlag = EF_NONE;
|
||||
elementActive = true;
|
||||
bgLayer = 0;
|
||||
tag = 0;
|
||||
templateIdx = -1;
|
||||
|
@ -307,8 +306,8 @@ static inline const Vector& getTagColor(int tag)
|
|||
|
||||
void Element::render(const RenderState& rs) const
|
||||
{
|
||||
if (!elementActive) return;
|
||||
|
||||
// FIXME: this should be part of the layer render, not here
|
||||
// (not relevant until Elements are batched per-layer)
|
||||
if (game->isSceneEditorActive() && this->bgLayer == game->sceneEditor.bgLayer
|
||||
&& game->sceneEditor.editType == ET_ELEMENTS)
|
||||
{
|
||||
|
@ -345,7 +344,7 @@ void Element::render(const RenderState& rs) const
|
|||
|
||||
void Element::fillGrid()
|
||||
{
|
||||
if (life == 1 && elementActive)
|
||||
if (life == 1 && !_hidden)
|
||||
{
|
||||
if (elementFlag == EF_SOLID)
|
||||
{
|
||||
|
|
|
@ -70,10 +70,10 @@ public:
|
|||
void render(const RenderState& rs) const OVERRIDE;
|
||||
ElementFlag elementFlag;
|
||||
void fillGrid();
|
||||
bool isElementActive() const { return elementActive; }
|
||||
bool isElementActive() const { return !_hidden; }
|
||||
int getElementEffectIndex();
|
||||
void setElementEffectByIndex(int e);
|
||||
void setElementActive(bool v) { elementActive = v; }
|
||||
void setElementActive(bool v) { _hidden = !v; }
|
||||
void doInteraction(Entity *ent, float mult, float touchWidth);
|
||||
void setTag(int tag);
|
||||
protected:
|
||||
|
@ -82,10 +82,7 @@ protected:
|
|||
void setGridFromWavy();
|
||||
ElementEffectData *eff;
|
||||
|
||||
void updateEffects(float dt);
|
||||
|
||||
bool elementActive;
|
||||
};
|
||||
void updateEffects(float dt);};
|
||||
|
||||
typedef std::vector<Element*> ElementContainer;
|
||||
|
||||
|
|
Loading…
Reference in a new issue