mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-25 14:15:46 +00:00
Merge branch 'experimental' of file:///Users/User/code/coding/Aquaria_fg_clean into experimental
This commit is contained in:
commit
f930450689
8 changed files with 116 additions and 18 deletions
|
@ -1074,14 +1074,33 @@ void AnimationEditor::applyTranslation()
|
|||
{
|
||||
int xdiff = editingBone->position.x - bcur->x;
|
||||
int ydiff = editingBone->position.y - bcur->y;
|
||||
// all bones mode
|
||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||
if(!core->getCtrlState())
|
||||
{
|
||||
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||
if (b)
|
||||
// all bones in one anim mode
|
||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||
{
|
||||
b->x += xdiff;
|
||||
b->y += ydiff;
|
||||
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||
if (b)
|
||||
{
|
||||
b->x += xdiff;
|
||||
b->y += ydiff;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// all bones in all anims mode
|
||||
for (int a = 0; a < editSprite->animations.size(); ++a)
|
||||
{
|
||||
for (int i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
||||
{
|
||||
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||
if (b)
|
||||
{
|
||||
b->x += xdiff;
|
||||
b->y += ydiff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1187,12 +1206,30 @@ void AnimationEditor::rmbu()
|
|||
if (bcur)
|
||||
{
|
||||
int rotdiff = editingBone->rotation.z - bcur->rot;
|
||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||
if (!core->getCtrlState())
|
||||
{
|
||||
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||
if (b)
|
||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||
{
|
||||
b->rot += rotdiff;
|
||||
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||
if (b)
|
||||
{
|
||||
b->rot += rotdiff;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// all bones in all anims mode
|
||||
for (int a = 0; a < editSprite->animations.size(); ++a)
|
||||
{
|
||||
for (int i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i)
|
||||
{
|
||||
BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||
if (b)
|
||||
{
|
||||
b->rot += rotdiff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -2334,6 +2334,8 @@ void DSQ::playPositionalSfx(const std::string &name, const Vector &position, flo
|
|||
|
||||
void DSQ::shutdown()
|
||||
{
|
||||
mod.stop();
|
||||
|
||||
Network::shutdown();
|
||||
|
||||
scriptInterface.shutdown();
|
||||
|
|
|
@ -257,6 +257,7 @@ class Mod
|
|||
{
|
||||
public:
|
||||
Mod();
|
||||
~Mod();
|
||||
void clear();
|
||||
void setActive(bool v);
|
||||
void start();
|
||||
|
@ -297,6 +298,7 @@ protected:
|
|||
|
||||
std::string name;
|
||||
std::string path;
|
||||
Precacher modcache;
|
||||
};
|
||||
|
||||
class AquariaScreenTransition : public ScreenTransition
|
||||
|
|
|
@ -39,6 +39,11 @@ Mod::Mod()
|
|||
shuttingDown = false;
|
||||
}
|
||||
|
||||
Mod::~Mod()
|
||||
{
|
||||
modcache.clean();
|
||||
}
|
||||
|
||||
/*
|
||||
queue for actual stop and recache
|
||||
which happens in game::applystate
|
||||
|
@ -182,6 +187,23 @@ void Mod::recache()
|
|||
|
||||
core->resetTimer();
|
||||
}
|
||||
|
||||
if(active)
|
||||
{
|
||||
modcache.setBaseDir(dsq->secondaryTexturePath);
|
||||
std::string fname = path;
|
||||
if(fname[fname.length() - 1] != '/')
|
||||
fname += '/';
|
||||
fname += "precache.txt";
|
||||
fname = localisePath(fname, dsq->mod.getPath());
|
||||
fname = core->adjustFilenameCase(fname);
|
||||
if (exists(fname))
|
||||
modcache.precacheList(fname);
|
||||
}
|
||||
else
|
||||
{
|
||||
modcache.clean();
|
||||
}
|
||||
}
|
||||
|
||||
void Mod::start()
|
||||
|
|
|
@ -3021,6 +3021,27 @@ luaFunc(spawnParticleEffect)
|
|||
luaReturnPtr(pe);
|
||||
}
|
||||
|
||||
luaFunc(setNumSuckPositions)
|
||||
{
|
||||
particleManager->setNumSuckPositions(lua_tointeger(L, 1));
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(setSuckPosition)
|
||||
{
|
||||
particleManager->setSuckPosition(lua_tointeger(L, 1), Vector(lua_tonumber(L, 2), lua_tonumber(L, 3)));
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(getSuckPosition)
|
||||
{
|
||||
Vector *v = particleManager->getSuckPosition(lua_tointeger(L, 1));
|
||||
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),
|
||||
|
|
|
@ -34,6 +34,11 @@ Precacher::~Precacher()
|
|||
errorLog ("Precacher shutdown unclean");
|
||||
}
|
||||
|
||||
void Precacher::setBaseDir(const std::string& dir)
|
||||
{
|
||||
basedirOverride = dir;
|
||||
}
|
||||
|
||||
void Precacher::clean()
|
||||
{
|
||||
for (unsigned int i = 0; i < renderObjects.size(); i++)
|
||||
|
@ -88,6 +93,8 @@ void Precacher::precacheTex(const std::string &tex)
|
|||
}
|
||||
if (tex.empty()) return;
|
||||
|
||||
std::string basedir = basedirOverride.empty() ? core->getBaseTextureDirectory() : basedirOverride;
|
||||
|
||||
if (core->debugLogTextures)
|
||||
debugLog("PRECACHING: " + tex);
|
||||
|
||||
|
@ -99,7 +106,7 @@ void Precacher::precacheTex(const std::string &tex)
|
|||
int loc = tex.find('*');
|
||||
std::string path = tex.substr(0, loc);
|
||||
std::string type = tex.substr(loc+1, tex.size());
|
||||
path = core->getBaseTextureDirectory() + path;
|
||||
path = basedir + path;
|
||||
forEachFile(path, type, precacherCallback, (intptr_t)this);
|
||||
return;
|
||||
}
|
||||
|
@ -108,9 +115,9 @@ void Precacher::precacheTex(const std::string &tex)
|
|||
if (loadProgressCallback)
|
||||
loadProgressCallback();
|
||||
std::string t = tex;
|
||||
if (tex.find(core->getBaseTextureDirectory()) != std::string::npos)
|
||||
if (tex.find(basedir) != std::string::npos)
|
||||
{
|
||||
t = tex.substr(core->getBaseTextureDirectory().size(), tex.size());
|
||||
t = tex.substr(basedir.size(), tex.size());
|
||||
}
|
||||
Quad *q = new Quad;
|
||||
q->setTexture(t);
|
||||
|
|
|
@ -32,11 +32,13 @@ public:
|
|||
void precacheList(const std::string &list, void progressCallback() = NULL);
|
||||
void clean();
|
||||
void loadTextureRange(const std::string &file, const std::string &type, int start, int end);
|
||||
void setBaseDir(const std::string& dir);
|
||||
|
||||
std::vector<RenderObject*> renderObjects;
|
||||
private:
|
||||
bool cleaned;
|
||||
void (*loadProgressCallback)();
|
||||
std::string basedirOverride;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue