diff options
-rw-r--r-- | res/sprites/boney_anim.txt | 4 | ||||
-rw-r--r-- | res/sprites/duster_anim.txt | 4 | ||||
-rw-r--r-- | res/sprites/kuma_anim.txt | 4 | ||||
-rw-r--r-- | res/sprites/lucas_anim.txt | 4 | ||||
-rw-r--r-- | src/animation_system.cpp | 15 | ||||
-rw-r--r-- | src/animation_system.h | 3 | ||||
-rw-r--r-- | src/character_system.cpp | 2 | ||||
-rw-r--r-- | src/sprite.h | 1 |
8 files changed, 9 insertions, 28 deletions
diff --git a/res/sprites/boney_anim.txt b/res/sprites/boney_anim.txt index 5dfb65f..65901b9 100644 --- a/res/sprites/boney_anim.txt +++ b/res/sprites/boney_anim.txt | |||
@@ -48,5 +48,5 @@ barking[up]: 4,36,44,36,44,36,44 | |||
48 | barking[up_right]: 5,37,45,37,45,37,45 | 48 | barking[up_right]: 5,37,45,37,45,37,45 |
49 | barking[right]: 6,38,46,38,46,38,46 | 49 | barking[right]: 6,38,46,38,46,38,46 |
50 | barking[down_right]: 7,39,47,39,47,39,47 | 50 | barking[down_right]: 7,39,47,39,47,39,47 |
51 | climb.[up]: 240,241,242,243,244,245,246,247,248,249,250,251,252 | 51 | climb[up]: 240,241,242,243,244,245,246,247,248,249,250,251,252 |
52 | climb.[down]: 253,254,255,256,257,258,259,260,261,262,263,264,265 \ No newline at end of file | 52 | climb[down]: 253,254,255,256,257,258,259,260,261,262,263,264,265 \ No newline at end of file |
diff --git a/res/sprites/duster_anim.txt b/res/sprites/duster_anim.txt index 538ddd1..9c1ed3f 100644 --- a/res/sprites/duster_anim.txt +++ b/res/sprites/duster_anim.txt | |||
@@ -40,5 +40,5 @@ run[up]: 76,84,92,100,108 | |||
40 | run[up_right]: 77,85,93,101,109 | 40 | run[up_right]: 77,85,93,101,109 |
41 | run[right]: 78,86,94,102,110 | 41 | run[right]: 78,86,94,102,110 |
42 | run[down_right]: 79,87,95,103,111 | 42 | run[down_right]: 79,87,95,103,111 |
43 | climb.[up]: 200,201,202,206,207,208,203,204,205,206,207,208 | 43 | climb[up]: 200,201,202,206,207,208,203,204,205,206,207,208 |
44 | climb.[down]: 200,201,202,206,207,208,203,204,205,206,207,208 \ No newline at end of file | 44 | climb[down]: 200,201,202,206,207,208,203,204,205,206,207,208 \ No newline at end of file |
diff --git a/res/sprites/kuma_anim.txt b/res/sprites/kuma_anim.txt index a691b7d..bd56fe6 100644 --- a/res/sprites/kuma_anim.txt +++ b/res/sprites/kuma_anim.txt | |||
@@ -48,5 +48,5 @@ talk[up]: 36,44 | |||
48 | talk[up_right]: 37,45 | 48 | talk[up_right]: 37,45 |
49 | talk[right]: 38,46 | 49 | talk[right]: 38,46 |
50 | talk[down_right]: 39,47 | 50 | talk[down_right]: 39,47 |
51 | climb.[up]: 257,258,259,263,264,265,260,261,262,263,264,265 | 51 | climb[up]: 257,258,259,263,264,265,260,261,262,263,264,265 |
52 | climb.[down]: 257,258,259,263,264,265,260,261,262,263,264,265 \ No newline at end of file | 52 | climb[down]: 257,258,259,263,264,265,260,261,262,263,264,265 \ No newline at end of file |
diff --git a/res/sprites/lucas_anim.txt b/res/sprites/lucas_anim.txt index cd5ee9f..3c2906c 100644 --- a/res/sprites/lucas_anim.txt +++ b/res/sprites/lucas_anim.txt | |||
@@ -42,5 +42,5 @@ run[right]: 73,81,89,97 | |||
42 | run[down_right]: 74,82,90,98 | 42 | run[down_right]: 74,82,90,98 |
43 | lightning_electrocute![down]: 116,117,118,116,117,118 | 43 | lightning_electrocute![down]: 116,117,118,116,117,118 |
44 | lightning_collapse![down]: 119,120,121,122 | 44 | lightning_collapse![down]: 119,120,121,122 |
45 | climb.[up]: 123,124,125,128,127,127,129,130,131,128,127,126 | 45 | climb[up]: 123,124,125,128,127,127,129,130,131,128,127,126 |
46 | climb.[down]: 123,124,125,128,127,127,129,130,131,128,127,126 \ No newline at end of file | 46 | climb[down]: 123,124,125,128,127,127,129,130,131,128,127,126 \ No newline at end of file |
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 | ||
117 | void 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 | |||
130 | void AnimationSystem::setSpriteDirection(int spriteId, Direction dir) { | 115 | void 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 | ||
24 | struct Animation { | 24 | struct 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 | ||