1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-26 14:45:48 +00:00

Make particle suck positions accessible to Lua, use suckpos 2, fix possible crash in entity_clearHair()

This commit is contained in:
fgenesis 2013-06-10 00:59:46 +02:00
parent 1ea1408ac4
commit f5f890aade
2 changed files with 31 additions and 5 deletions

View file

@ -2158,7 +2158,8 @@ void Avatar::loseTargets()
void Avatar::updateTargetQuads(float dt)
{
particleManager->setSuckPosition(1, dsq->getGameCursorPosition());
const Vector cursorpos = dsq->getGameCursorPosition();
particleManager->setSuckPosition(1, cursorpos);
/*
for (int i = 0; i < targetQuads.size(); i++)
@ -2189,7 +2190,8 @@ void Avatar::updateTargetQuads(float dt)
targets[i].pos = e->getTargetPoint(targets[i].targetPt);
if (i == 0)
{
particleManager->setSuckPosition(1, targets[i].pos);
particleManager->setSuckPosition(1, targets[i].pos); // suckpos 1 is overridden elsewhere later
particleManager->setSuckPosition(2, targets[i].pos);
}
/*
@ -2202,7 +2204,7 @@ void Avatar::updateTargetQuads(float dt)
}
else
{
targetQuads[i]->position = dsq->getGameCursorPosition();
targetQuads[i]->position = cursorpos;
//targetQuads[i]->alpha.interpolateTo(0, 0.1);
}
}
@ -2222,7 +2224,7 @@ void Avatar::updateTargetQuads(float dt)
debugLog(os.str());
*/
targetQuads[i]->position = dsq->getGameCursorPosition();
targetQuads[i]->position = cursorpos;
if (dsq->continuity.form == FORM_ENERGY && isInputEnabled())
{
if (dsq->inputMode == INPUT_JOYSTICK && targetQuads[i]->isRunning())

View file

@ -3021,6 +3021,27 @@ luaFunc(spawnParticleEffect)
luaReturnPtr(pe);
}
luaFunc(setNumSuckPositions)
{
particleManager->setNumSuckPositions(lua_tointeger(L, 0));
luaReturnNil();
}
luaFunc(setSuckPosition)
{
particleManager->setSuckPosition(lua_tointeger(L, 0), Vector(lua_tonumber(L, 1), lua_tonumber(L, 2)));
luaReturnNil();
}
luaFunc(getSuckPosition)
{
Vector *v = particleManager->getSuckPosition(lua_tointeger(L, 0));
if(v)
luaReturnVec2(v->x, v->y);
luaReturnVec2(0.0f, 0.0f);
}
luaFunc(bone_showFrame)
{
Bone *b = bone(L);
@ -6958,7 +6979,7 @@ luaFunc(entity_getHair)
luaFunc(entity_clearHair)
{
Entity *e = entity(L);
if (e)
if (e && e->hair)
{
e->hair->safeKill();
e->hair = 0;
@ -8157,6 +8178,9 @@ static const struct {
luaRegister(resetTimer),
luaRegister(addInfluence),
luaRegister(setSuckPosition),
luaRegister(setSuckPosition);
luaRegister(setNumSuckPositions),
luaRegister(setupBasicEntity),
luaRegister(playMusic),
luaRegister(playMusicStraight),