diff --git a/Aquaria/Avatar.cpp b/Aquaria/Avatar.cpp index e8e75d7..ea5856e 100644 --- a/Aquaria/Avatar.cpp +++ b/Aquaria/Avatar.cpp @@ -574,6 +574,7 @@ void SongIcon::openNote() float glowLife = 0.5; + { Quad *q = new Quad("particles/glow", position); q->scale.interpolateTo(Vector(10, 10), glowLife+0.1f); q->alpha.ensureData(); @@ -585,6 +586,8 @@ void SongIcon::openNote() q->setBlendType(RenderObject::BLEND_ADD); q->followCamera = 1; dsq->game->addRenderObject(q, LR_HUD); + q->setDecayRate(1/(glowLife+0.1f)); + } { std::ostringstream os2; @@ -603,6 +606,7 @@ void SongIcon::openNote() //q->setBlendType(RenderObject::BLEND_ADD); q->followCamera = 1; dsq->game->addRenderObject(q, LR_HUD); + q->setDecayRate(1/(glowLife+0.1f)); } avatar->songInterfaceTimer = 1.0; @@ -1422,7 +1426,7 @@ void Avatar::openSingingInterface() //core->setMousePosition(Vector(400,300)); } - core->setMouseConstraintCircle(singingInterfaceRadius); + core->setMouseConstraintCircle(core->center, singingInterfaceRadius); stopRoll(); singing = true; currentSongIdx = SONG_NONE; diff --git a/Aquaria/GridRender.cpp b/Aquaria/GridRender.cpp index 3ebcd41..bbfd4a3 100644 --- a/Aquaria/GridRender.cpp +++ b/Aquaria/GridRender.cpp @@ -166,16 +166,7 @@ void SongLineRender::newPoint(const Vector &pt, const Vector &color) s.color = color; pts.push_back(s); if (pts.size() > maxx) - { - std::vector copy; - copy = pts; - pts.clear(); - for (int i = 1; i < copy.size(); i++) - { - pts.push_back(copy[i]); - } - } - + pts.erase(pts.begin()); } else if (!pts.empty() && inRange) { diff --git a/Aquaria/ScriptInterface.cpp b/Aquaria/ScriptInterface.cpp index 7a86a10..44197f6 100644 --- a/Aquaria/ScriptInterface.cpp +++ b/Aquaria/ScriptInterface.cpp @@ -8060,6 +8060,18 @@ luaFunc(getMouseWheelChange) luaReturnNum(core->mouse.scrollWheelChange); } +luaFunc(setMouseConstraintCircle) +{ + core->setMouseConstraintCircle(Vector(lua_tonumber(L, 1), lua_tonumber(L, 2)), lua_tonumber(L, 3)); + luaReturnNil(); +} + +luaFunc(setMouseConstraint) +{ + core->setMouseConstraint(getBool(L, 1)); + luaReturnNil(); +} + luaFunc(fade) { dsq->overlay->color.interpolateTo(Vector(lua_tonumber(L, 3), lua_tonumber(L, 4), lua_tonumber(L, 5)), lua_tonumber(L, 6)); @@ -9114,6 +9126,8 @@ static const struct { luaRegister(getMousePos), luaRegister(getMouseWorldPos), luaRegister(getMouseWheelChange), + luaRegister(setMouseConstraintCircle), + luaRegister(setMouseConstraint), luaRegister(resetContinuity), diff --git a/BBGE/Core.cpp b/BBGE/Core.cpp index ac0f4dd..459ceb3 100644 --- a/BBGE/Core.cpp +++ b/BBGE/Core.cpp @@ -3296,10 +3296,12 @@ void Core::setMouseConstraint(bool on) mouseConstraint = on; } -void Core::setMouseConstraintCircle(float circle) +void Core::setMouseConstraintCircle(const Vector& pos, float circle) { mouseConstraint = true; mouseCircle = circle; + mouseConstraintCenter = pos; + mouseConstraintCenter.z = 0; } /* @@ -3333,7 +3335,7 @@ bool Core::doMouseConstraint() { //- core->getVirtualOffX() //- virtualOffX - Vector h = Vector(core->center.x , core->center.y); + Vector h = mouseConstraintCenter; Vector d = mouse.position - h; if (!d.isLength2DIn(mouseCircle)) { diff --git a/BBGE/Core.h b/BBGE/Core.h index da4e73e..55d2233 100644 --- a/BBGE/Core.h +++ b/BBGE/Core.h @@ -1037,7 +1037,7 @@ public: void removeRenderObject(RenderObject *r, RemoveRenderObjectFlag flag = DESTROY_RENDER_OBJECT); void setMouseConstraint(bool on); - void setMouseConstraintCircle(float mouseCircle); + void setMouseConstraintCircle(const Vector& pos, float mouseCircle); void setReentryInputGrab(int on); @@ -1350,6 +1350,7 @@ protected: std::string appName; bool mouseConstraint; float mouseCircle; + Vector mouseConstraintCenter; bool doMouseConstraint(); diff --git a/BBGE/Emitter.cpp b/BBGE/Emitter.cpp index 31c693e..dc855cf 100644 --- a/BBGE/Emitter.cpp +++ b/BBGE/Emitter.cpp @@ -284,6 +284,8 @@ void Emitter::onRender() if (hasRot) { + Vector colorMult = data.inheritColor ? pe->color : Vector(1, 1, 1); + float alphaMult = data.inheritAlpha ? pe->alpha.x : 1; for (Particles::iterator i = particles.begin(); i != particles.end(); i++) { Particle *p = *i; @@ -293,7 +295,8 @@ void Emitter::onRender() const float dy = h2 * p->scale.y; #ifdef BBGE_BUILD_OPENGL - glColor4f(p->color.x, p->color.y, p->color.z, p->alpha.x); + Vector col = p->color * colorMult; + glColor4f(col.x, col.y, col.z, p->alpha.x * alphaMult); if (p->rot.z != 0 || p->rot.isInterpolating()) diff --git a/BBGE/ParticleEffect.cpp b/BBGE/ParticleEffect.cpp index 72dde64..7209a0c 100644 --- a/BBGE/ParticleEffect.cpp +++ b/BBGE/ParticleEffect.cpp @@ -404,6 +404,16 @@ void ParticleEffect::bankLoad(const std::string &file, const std::string &path) inf >> tmp; inf >> currentEmitter->data.suckIndex >> currentEmitter->data.suckStr; } + else if (token == "InheritColor") + { + inf >> tmp; + inf >> currentEmitter->data.inheritColor; + } + else if (token == "InheritAlpha") + { + inf >> tmp; + inf >> currentEmitter->data.inheritAlpha; + } } } } diff --git a/BBGE/Particles.h b/BBGE/Particles.h index 4eb8a90..21b96ee 100644 --- a/BBGE/Particles.h +++ b/BBGE/Particles.h @@ -72,6 +72,8 @@ struct SpawnParticleData float counter; float spawnTimeOffset; bool spawnLocal; + bool inheritColor; + bool inheritAlpha; float lastDTDifference; int groupRender; diff --git a/BBGE/SpawnParticleData.cpp b/BBGE/SpawnParticleData.cpp index 0c99aef..f6f89cd 100644 --- a/BBGE/SpawnParticleData.cpp +++ b/BBGE/SpawnParticleData.cpp @@ -70,4 +70,6 @@ SpawnParticleData::SpawnParticleData() groupRender = 0; pauseLevel = 0; copyParentFlip = 0; + inheritColor = false; + inheritAlpha = false; }