summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/animation_system.cpp15
-rw-r--r--src/animation_system.h3
-rw-r--r--src/character_system.cpp2
-rw-r--r--src/sprite.h1
4 files changed, 1 insertions, 20 deletions
diff --git a/src/animation_system.cpp b/src/animation_system.cpp index a280aee..2c2c6a5 100644 --- a/src/animation_system.cpp +++ b/src/animation_system.cpp
@@ -78,8 +78,6 @@ void AnimationSystem::initSprite(int spriteId, std::string_view filename) {
78 78
79 if (animName.back() == '!') { 79 if (animName.back() == '!') {
80 anim.looping = false; 80 anim.looping = false;
81 } else if (animName.back() == '.') {
82 anim.manual = true;
83 } 81 }
84 82
85 int animId = sprite.animations.size(); 83 int animId = sprite.animations.size();
@@ -114,19 +112,6 @@ void AnimationSystem::tick(double dt) {
114 } 112 }
115} 113}
116 114
117void AnimationSystem::advanceAnimation(int spriteId) {
118 Sprite& sprite = game_.getSprite(spriteId);
119 Animation& animation = sprite.animations[sprite.animationId];
120
121 if (animation.manual) {
122 sprite.animationFrame++;
123
124 if (sprite.animationFrame >= animation.frameIndices.size()) {
125 sprite.animationFrame = 0;
126 }
127 }
128}
129
130void AnimationSystem::setSpriteDirection(int spriteId, Direction dir) { 115void AnimationSystem::setSpriteDirection(int spriteId, Direction dir) {
131 Sprite& sprite = game_.getSprite(spriteId); 116 Sprite& sprite = game_.getSprite(spriteId);
132 if (sprite.dir != dir) { 117 if (sprite.dir != dir) {
diff --git a/src/animation_system.h b/src/animation_system.h index 8352c19..a116673 100644 --- a/src/animation_system.h +++ b/src/animation_system.h
@@ -17,9 +17,6 @@ public:
17 17
18 void tick(double dt) override; 18 void tick(double dt) override;
19 19
20 // Advances animation by a frame. Only to be used on manual animations.
21 void advanceAnimation(int spriteId);
22
23 void initSprite(int spriteId, std::string_view filename); 20 void initSprite(int spriteId, std::string_view filename);
24 21
25 void setSpriteDirection(int spriteId, Direction dir); 22 void setSpriteDirection(int spriteId, Direction dir);
diff --git a/src/character_system.cpp b/src/character_system.cpp index 27c2280..ea469d5 100644 --- a/src/character_system.cpp +++ b/src/character_system.cpp
@@ -349,7 +349,7 @@ void CharacterSystem::setAnimationFor(int spriteId, CharacterState state) {
349 break; 349 break;
350 } 350 }
351 case CharacterMedium::Ladder: { 351 case CharacterMedium::Ladder: {
352 game_.getSystem<AnimationSystem>().setSpriteAnimation(spriteId, "climb."); 352 game_.getSystem<AnimationSystem>().setSpriteAnimation(spriteId, "climb");
353 353
354 if (state == CharacterState::Still || state == CharacterState::Crouching) { 354 if (state == CharacterState::Still || state == CharacterState::Crouching) {
355 sprite.animPaused = true; 355 sprite.animPaused = true;
diff --git a/src/sprite.h b/src/sprite.h index 59d2caf..5750308 100644 --- a/src/sprite.h +++ b/src/sprite.h
@@ -23,7 +23,6 @@ struct SpriteFrame {
23 23
24struct Animation { 24struct Animation {
25 bool looping = true; 25 bool looping = true;
26 bool manual = false;
27 std::vector<int> frameIndices; 26 std::vector<int> frameIndices;
28}; 27};
29 28