mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-29 03:33:48 +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()
|
Element::Element() : Quad()
|
||||||
{
|
{
|
||||||
elementFlag = EF_NONE;
|
elementFlag = EF_NONE;
|
||||||
elementActive = true;
|
|
||||||
bgLayer = 0;
|
bgLayer = 0;
|
||||||
tag = 0;
|
tag = 0;
|
||||||
templateIdx = -1;
|
templateIdx = -1;
|
||||||
|
@ -307,8 +306,8 @@ static inline const Vector& getTagColor(int tag)
|
||||||
|
|
||||||
void Element::render(const RenderState& rs) const
|
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
|
if (game->isSceneEditorActive() && this->bgLayer == game->sceneEditor.bgLayer
|
||||||
&& game->sceneEditor.editType == ET_ELEMENTS)
|
&& game->sceneEditor.editType == ET_ELEMENTS)
|
||||||
{
|
{
|
||||||
|
@ -345,7 +344,7 @@ void Element::render(const RenderState& rs) const
|
||||||
|
|
||||||
void Element::fillGrid()
|
void Element::fillGrid()
|
||||||
{
|
{
|
||||||
if (life == 1 && elementActive)
|
if (life == 1 && !_hidden)
|
||||||
{
|
{
|
||||||
if (elementFlag == EF_SOLID)
|
if (elementFlag == EF_SOLID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,10 +70,10 @@ public:
|
||||||
void render(const RenderState& rs) const OVERRIDE;
|
void render(const RenderState& rs) const OVERRIDE;
|
||||||
ElementFlag elementFlag;
|
ElementFlag elementFlag;
|
||||||
void fillGrid();
|
void fillGrid();
|
||||||
bool isElementActive() const { return elementActive; }
|
bool isElementActive() const { return !_hidden; }
|
||||||
int getElementEffectIndex();
|
int getElementEffectIndex();
|
||||||
void setElementEffectByIndex(int e);
|
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 doInteraction(Entity *ent, float mult, float touchWidth);
|
||||||
void setTag(int tag);
|
void setTag(int tag);
|
||||||
protected:
|
protected:
|
||||||
|
@ -82,10 +82,7 @@ protected:
|
||||||
void setGridFromWavy();
|
void setGridFromWavy();
|
||||||
ElementEffectData *eff;
|
ElementEffectData *eff;
|
||||||
|
|
||||||
void updateEffects(float dt);
|
void updateEffects(float dt);};
|
||||||
|
|
||||||
bool elementActive;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector<Element*> ElementContainer;
|
typedef std::vector<Element*> ElementContainer;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue