1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-25 15:33:57 +00:00

Move RenderObject::positionSnapTo to PauseQuad

And another RenderObject member less...
This commit is contained in:
fgenesis 2022-05-18 02:49:14 +02:00
parent 046b98c725
commit c82aab1e51
7 changed files with 15 additions and 51 deletions

View file

@ -4738,29 +4738,6 @@ void Avatar::setHeadTexture(const std::string &name, float time)
}
}
void Avatar::chargeVisualEffect(const std::string &tex)
{
float time = 0.4f;
Quad *chargeEffect = new Quad;
chargeEffect->setBlendType(BLEND_ADD);
chargeEffect->alpha.ensureData();
chargeEffect->alpha.data->path.addPathNode(0, 0);
chargeEffect->alpha.data->path.addPathNode(0.6f, 0.1f);
chargeEffect->alpha.data->path.addPathNode(0.6f, 0.9f);
chargeEffect->alpha.data->path.addPathNode(0, 1);
chargeEffect->alpha.startPath(time);
chargeEffect->setTexture(tex);
//chargeEffect->positionSnapTo = &this->position;
chargeEffect->position = this->position;
chargeEffect->setPositionSnapTo(&position);
chargeEffect->setLife(1);
chargeEffect->setDecayRate(1.0f/time);
chargeEffect->scale = Vector(0.1f, 0.1f);
chargeEffect->scale.interpolateTo(Vector(1,1),time);
//chargeEffect->rotation.interpolateTo(Vector(0,0,360), time);
dsq->game->addRenderObject(chargeEffect, LR_PARTICLES);
}
void Avatar::updateFormVisualEffects(float dt)
{
switch (dsq->continuity.form)
@ -5928,7 +5905,6 @@ void Avatar::onUpdate(float dt)
chargingEmitter->load("ChargingEnergy2");
//chargeVisualEffect("particles/energy-charge-2");
}
}
break;

View file

@ -218,7 +218,6 @@ public:
float headTextureTimer;
void updateDamageVisualEffects();
int chargeLevelAttained;
void chargeVisualEffect(const std::string &tex);
void updateFormVisualEffects(float dt);
bool isSinging();
bool isLockable();

View file

@ -3992,14 +3992,11 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
{
case VFX_SHOCK:
{
core->sound->playSfx("ShockWave");
float t =1.0;
Quad *q = new Quad;
PauseQuad *q = new PauseQuad;
q->position = position;
q->scale = Vector(0,0);
q->scale.interpolateTo(Vector(5,5),t);
@ -4013,7 +4010,7 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
q->setBlendType(RenderObject::BLEND_ADD);
q->setTexture("particles/EnergyRing");
if (target)
q->positionSnapTo = &target->position;
q->setPositionSnapTo(&target->position);
game->addRenderObject(q, LR_PARTICLES);
@ -4023,7 +4020,7 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
t = 0.75f;
{
Quad *q = new Quad;
PauseQuad *q = new PauseQuad;
q->position = position;
q->scale = Vector(0.5,0.5);
q->scale.interpolateTo(Vector(2,2),t);
@ -4036,7 +4033,7 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
q->setBlendType(RenderObject::BLEND_ADD);
q->setTexture("particles/EnergyPart");
if (target)
q->positionSnapTo = &target->position;
q->setPositionSnapTo(&target->position);
q->rotation.z = rand()%360;
game->addRenderObject(q, LR_PARTICLES);
}

View file

@ -622,16 +622,23 @@ void Quad::onSetTexture()
}
}
PauseQuad::PauseQuad() : Quad(), pauseLevel(0)
PauseQuad::PauseQuad() : Quad(), pauseLevel(0), positionSnapTo(0)
{
addType(SCO_PAUSEQUAD);
}
void PauseQuad::onUpdate(float dt)
{
if (positionSnapTo)
this->position = *positionSnapTo;
if (core->particlesPaused <= pauseLevel)
{
Quad::onUpdate(dt);
}
}
void PauseQuad::setPositionSnapTo(InterpolatedVector *positionSnapTo)
{
this->positionSnapTo = positionSnapTo;
}

View file

@ -128,7 +128,10 @@ class PauseQuad : public Quad
public:
PauseQuad();
int pauseLevel;
void setPositionSnapTo(InterpolatedVector *positionSnapTo);
protected:
InterpolatedVector *positionSnapTo;
void onUpdate(float dt);
};

View file

@ -151,9 +151,6 @@ RenderObject::RenderObject()
pm = PM_NONE;
positionSnapTo = 0;
blendEnabled = true;
texture = 0;
width = 0;
@ -576,12 +573,6 @@ void RenderObject::render()
void RenderObject::renderCall()
{
if (positionSnapTo)
this->position = *positionSnapTo;
position += offset;
@ -1095,11 +1086,6 @@ StateData *RenderObject::getStateData()
return stateData;
}
void RenderObject::setPositionSnapTo(InterpolatedVector *positionSnapTo)
{
this->positionSnapTo = positionSnapTo;
}
void RenderObject::setOverrideCullRadius(float ovr)
{
overrideCullRadiusSqr = ovr * ovr;

View file

@ -167,8 +167,6 @@ public:
StateData *getStateData();
void setPositionSnapTo(InterpolatedVector *positionSnapTo);
// HACK: This is defined in RenderObject_inline.h because it needs
// the class Core definition. --achurch
inline bool isOnScreen();
@ -258,8 +256,6 @@ public:
float updateCull;
int layer;
InterpolatedVector *positionSnapTo;
typedef std::vector<RenderObject*> Children;
Children children, childGarbage;