mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-04 10:34:01 +00:00
Merge branch 'experimental' of file:///Users/User/code/coding/Aquaria_fg_clean into experimental
This commit is contained in:
commit
77b56cf19b
5 changed files with 68 additions and 25 deletions
|
@ -3107,7 +3107,7 @@ bool Entity::doCollisionAvoidance(float dt, int search, float mod, Vector *vp, i
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::initHair(int numSegments, int segmentLength, int width, const std::string &tex)
|
void Entity::initHair(int numSegments, float segmentLength, float width, const std::string &tex)
|
||||||
{
|
{
|
||||||
if (hair)
|
if (hair)
|
||||||
{
|
{
|
||||||
|
|
|
@ -486,7 +486,7 @@ public:
|
||||||
|
|
||||||
virtual bool canSetBoneLock();
|
virtual bool canSetBoneLock();
|
||||||
|
|
||||||
void initHair(int numSegments, int segmentLength, int width, const std::string &tex);
|
void initHair(int numSegments, float segmentLength, float width, const std::string &tex);
|
||||||
void updateHair(float dt);
|
void updateHair(float dt);
|
||||||
void setHairHeadPosition(const Vector &pos);
|
void setHairHeadPosition(const Vector &pos);
|
||||||
void exertHairForce(const Vector &force, float dt);
|
void exertHairForce(const Vector &force, float dt);
|
||||||
|
|
|
@ -25,13 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
// nodes = 40
|
// nodes = 40
|
||||||
// segmentLength = 3
|
// segmentLength = 3
|
||||||
Hair::Hair(int nodes, int segmentLength, int hairWidth) : RenderObject()
|
Hair::Hair(int nodes, float segmentLength, float hairWidth) : RenderObject()
|
||||||
{
|
{
|
||||||
this->segmentLength = segmentLength;
|
this->segmentLength = segmentLength;
|
||||||
this->hairWidth = hairWidth;
|
this->hairWidth = hairWidth;
|
||||||
waveTimer = 0;
|
|
||||||
waveAmount = 5;
|
|
||||||
//hairWidth = 10;
|
|
||||||
|
|
||||||
cull = false;
|
cull = false;
|
||||||
|
|
||||||
|
@ -46,7 +43,6 @@ Hair::Hair(int nodes, int segmentLength, int hairWidth) : RenderObject()
|
||||||
hairNodes[i].percent = 1.0f-perc;
|
hairNodes[i].percent = 1.0f-perc;
|
||||||
hairNodes[i].position = hairNodes[i].originalPosition = hairNodes[i].defaultPosition = Vector(0, i*segmentLength, 0);
|
hairNodes[i].position = hairNodes[i].originalPosition = hairNodes[i].defaultPosition = Vector(0, i*segmentLength, 0);
|
||||||
}
|
}
|
||||||
hairTimer = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hair::exertWave(float dt)
|
void Hair::exertWave(float dt)
|
||||||
|
@ -196,15 +192,6 @@ void Hair::onRender()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hair::updateWaveTimer(float dt)
|
|
||||||
{
|
|
||||||
waveTimer += dt;
|
|
||||||
for (int i = 1; i < hairNodes.size(); i++)
|
|
||||||
{
|
|
||||||
hairNodes[i].defaultPosition = hairNodes[i].originalPosition + Vector(cosf(waveTimer+i)*waveAmount*hairNodes[i].percent, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hair::onUpdate(float dt)
|
void Hair::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
RenderObject::onUpdate(dt);
|
RenderObject::onUpdate(dt);
|
||||||
|
|
|
@ -38,13 +38,13 @@ struct HairNode
|
||||||
class Hair : public RenderObject
|
class Hair : public RenderObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Hair(int nodes=40, int segmentLength=3, int width=18);
|
Hair(int nodes=40, float segmentLength=3, float width=18);
|
||||||
|
|
||||||
void exertForce(const Vector &force, float dt, int usePerc=0);
|
void exertForce(const Vector &force, float dt, int usePerc=0);
|
||||||
void updatePositions();
|
void updatePositions();
|
||||||
void returnToDefaultPositions(float dt);
|
void returnToDefaultPositions(float dt);
|
||||||
|
|
||||||
int hairWidth;
|
float hairWidth;
|
||||||
|
|
||||||
std::vector<HairNode> hairNodes;
|
std::vector<HairNode> hairNodes;
|
||||||
|
|
||||||
|
@ -54,10 +54,6 @@ public:
|
||||||
void exertGravityWave(float dt);
|
void exertGravityWave(float dt);
|
||||||
HairNode *getHairNode(int idx);
|
HairNode *getHairNode(int idx);
|
||||||
protected:
|
protected:
|
||||||
float hairTimer;
|
|
||||||
void updateWaveTimer(float dt);
|
|
||||||
int waveAmount;
|
|
||||||
float waveTimer;
|
|
||||||
float segmentLength;
|
float segmentLength;
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
void onRender();
|
void onRender();
|
||||||
|
|
|
@ -1535,6 +1535,21 @@ luaFunc(obj_fadeAlphaWithLife)
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(obj_getWorldScale)
|
||||||
|
{
|
||||||
|
RenderObject *r = robj(L);
|
||||||
|
Vector s;
|
||||||
|
if (r)
|
||||||
|
s = r->getRealScale();
|
||||||
|
luaReturnVec2(s.x, s.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(obj_getParent)
|
||||||
|
{
|
||||||
|
RenderObject *r = robj(L);
|
||||||
|
luaReturnPtr(r ? r->getParent() : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----- end RenderObject common functions -----
|
// ----- end RenderObject common functions -----
|
||||||
|
|
||||||
|
@ -1746,6 +1761,8 @@ luaFunc(quad_getBorderAlpha)
|
||||||
RO_FUNC(getter, prefix, collideCircleVsLineAngle) \
|
RO_FUNC(getter, prefix, collideCircleVsLineAngle) \
|
||||||
RO_FUNC(getter, prefix, getVectorToObj ) \
|
RO_FUNC(getter, prefix, getVectorToObj ) \
|
||||||
RO_FUNC(getter, prefix, fadeAlphaWithLife ) \
|
RO_FUNC(getter, prefix, fadeAlphaWithLife ) \
|
||||||
|
RO_FUNC(getter, prefix, getWorldScale ) \
|
||||||
|
RO_FUNC(getter, prefix, getParent ) \
|
||||||
MK_ALIAS(prefix, fh, flipHorizontal ) \
|
MK_ALIAS(prefix, fh, flipHorizontal ) \
|
||||||
MK_ALIAS(prefix, fv, flipVertical )
|
MK_ALIAS(prefix, fv, flipVertical )
|
||||||
|
|
||||||
|
@ -3815,17 +3832,29 @@ luaFunc(entity_getAnimationLength)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
float ret=0;
|
float ret=0;
|
||||||
int layer = lua_tonumber(L, 2);
|
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
if (Animation *anim = e->skeletalSprite.getCurrentAnimation(layer))
|
Animation *anim = 0;
|
||||||
|
if (lua_isstring(L, 2))
|
||||||
|
anim = e->skeletalSprite.getAnimation(lua_tostring(L, 2));
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ret = anim->getAnimationLength();
|
int layer = lua_tointeger(L, 2);
|
||||||
|
anim = e->skeletalSprite.getCurrentAnimation(layer);
|
||||||
}
|
}
|
||||||
|
if (anim)
|
||||||
|
ret = anim->getAnimationLength();
|
||||||
}
|
}
|
||||||
luaReturnNum(ret);
|
luaReturnNum(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(entity_hasAnimation)
|
||||||
|
{
|
||||||
|
Entity *e = entity(L);
|
||||||
|
Animation *anim = e->skeletalSprite.getAnimation(getString(L, 2));
|
||||||
|
luaReturnBool(anim != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(entity_isFollowingPath)
|
luaFunc(entity_isFollowingPath)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
|
@ -4233,6 +4262,15 @@ luaFunc(beam_setPosition_override)
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(beam_getEndPos)
|
||||||
|
{
|
||||||
|
Beam *b = beam(L);
|
||||||
|
Vector v;
|
||||||
|
if (b)
|
||||||
|
v = b->endPos;
|
||||||
|
luaReturnVec2(v.x, v.y);
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(getStringBank)
|
luaFunc(getStringBank)
|
||||||
{
|
{
|
||||||
luaReturnStr(dsq->continuity.stringBank.get(lua_tointeger(L, 1)).c_str());
|
luaReturnStr(dsq->continuity.stringBank.get(lua_tointeger(L, 1)).c_str());
|
||||||
|
@ -4411,6 +4449,8 @@ luaFunc(entity_damage)
|
||||||
d.damageType = (DamageType)lua_tointeger(L, 4);
|
d.damageType = (DamageType)lua_tointeger(L, 4);
|
||||||
d.effectTime = lua_tonumber(L, 5);
|
d.effectTime = lua_tonumber(L, 5);
|
||||||
d.useTimer = !getBool(L, 6);
|
d.useTimer = !getBool(L, 6);
|
||||||
|
d.shot = lua_isuserdata(L, 7) ? getShot(L, 7) : NULL;
|
||||||
|
d.hitPos = Vector(lua_tonumber(L, 8), lua_tonumber(L, 9));
|
||||||
didDamage = e->damage(d);
|
didDamage = e->damage(d);
|
||||||
}
|
}
|
||||||
luaReturnBool(didDamage);
|
luaReturnBool(didDamage);
|
||||||
|
@ -4448,6 +4488,22 @@ luaFunc(entity_setHealth)
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(entity_setCurrentHealth)
|
||||||
|
{
|
||||||
|
Entity *e = entity(L, 1);
|
||||||
|
if (e)
|
||||||
|
e->health = lua_tonumber(L, 2);
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
|
luaFunc(entity_setMaxHealth)
|
||||||
|
{
|
||||||
|
Entity *e = entity(L, 1);
|
||||||
|
if (e)
|
||||||
|
e->maxHealth = lua_tonumber(L, 2);
|
||||||
|
luaReturnNil();
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(entity_changeHealth)
|
luaFunc(entity_changeHealth)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L, 1);
|
Entity *e = entity(L, 1);
|
||||||
|
@ -8716,6 +8772,7 @@ static const struct {
|
||||||
luaRegister(beam_setBeamWidth),
|
luaRegister(beam_setBeamWidth),
|
||||||
luaRegister(beam_setFirer),
|
luaRegister(beam_setFirer),
|
||||||
luaRegister(beam_setDamageType),
|
luaRegister(beam_setDamageType),
|
||||||
|
luaRegister(beam_getEndPos),
|
||||||
|
|
||||||
luaRegister(getStringBank),
|
luaRegister(getStringBank),
|
||||||
|
|
||||||
|
@ -9297,6 +9354,8 @@ static const struct {
|
||||||
|
|
||||||
|
|
||||||
luaRegister(entity_setHealth),
|
luaRegister(entity_setHealth),
|
||||||
|
luaRegister(entity_setCurrentHealth),
|
||||||
|
luaRegister(entity_setMaxHealth),
|
||||||
luaRegister(entity_changeHealth),
|
luaRegister(entity_changeHealth),
|
||||||
|
|
||||||
luaRegister(node_setActive),
|
luaRegister(node_setActive),
|
||||||
|
@ -9325,6 +9384,7 @@ static const struct {
|
||||||
luaRegister(entity_isAnimating),
|
luaRegister(entity_isAnimating),
|
||||||
luaRegister(entity_getAnimationName),
|
luaRegister(entity_getAnimationName),
|
||||||
luaRegister(entity_getAnimationLength),
|
luaRegister(entity_getAnimationLength),
|
||||||
|
luaRegister(entity_hasAnimation),
|
||||||
|
|
||||||
luaRegister(entity_setCull),
|
luaRegister(entity_setCull),
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue