1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-26 02:07:26 +00:00

Make Bone::ANIM_* a bitmask. This also changes Lua constant ANIM_ALL from 10 to 3.

This commit is contained in:
fgenesis 2022-09-14 05:20:37 +02:00
parent 8e979e0e05
commit a1005dafe2
2 changed files with 8 additions and 8 deletions

View file

@ -1891,20 +1891,20 @@ void AnimationLayer::updateBones()
float rot = (bkey2->rot - bkey1->rot)*dt + bkey1->rot;
p = Vector((p.x-b->position.x)*fallThru+b->position.x, (p.y-b->position.y)*fallThru+b->position.y);
rot = (rot-b->rotation.z)*fallThru + b->rotation.z;
if (b->animated==Bone::ANIM_ALL || b->animated==Bone::ANIM_POS)
if (b->animated & Bone::ANIM_POS)
b->position = p;
if (b->animated==Bone::ANIM_ALL || b->animated==Bone::ANIM_ROT)
if (b->animated & Bone::ANIM_ROT)
b->rotation.z = rot;
}
else
{
int lerpType = key2->lerpType;
//k(0)×(2u3-3u2+1) + k(1)×(3u2-2u3)
if (b->animated==Bone::ANIM_ALL || b->animated==Bone::ANIM_POS)
if (b->animated & Bone::ANIM_POS)
{
b->position = Vector(lerp(bkey1->x, bkey2->x, dt, lerpType), lerp(bkey1->y, bkey2->y, dt, lerpType));
}
if (b->animated==Bone::ANIM_ALL || b->animated==Bone::ANIM_ROT)
if (b->animated & Bone::ANIM_ROT)
{
b->rotation.z = lerp(bkey1->rot, bkey2->rot, dt, lerpType);
}

View file

@ -51,10 +51,10 @@ public:
void setAnimated(int a);
enum {
ANIM_NONE = 0,
ANIM_POS = 1,
ANIM_ROT = 2,
ANIM_ALL = 10
ANIM_NONE = 0x00,
ANIM_POS = 0x01,
ANIM_ROT = 0x02,
ANIM_ALL = ANIM_POS | ANIM_ROT
};
void createStrip(bool vert, int num);
Quad* addFrame(const std::string &gfx);