summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-24 10:12:18 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2021-02-24 16:00:53 -0500
commit135e71d650e5a414219729cd84a2c917a3e8f1fb (patch)
tree7d5f2c99a8be34e27bb1644282576371bd0ab98e
parentb06b259c54e09f1a4026191d6eec9684599bd370 (diff)
downloadtanetane-135e71d650e5a414219729cd84a2c917a3e8f1fb.tar.gz
tanetane-135e71d650e5a414219729cd84a2c917a3e8f1fb.tar.bz2
tanetane-135e71d650e5a414219729cd84a2c917a3e8f1fb.zip
Removed manual animation stuff
-rw-r--r--res/sprites/boney_anim.txt4
-rw-r--r--res/sprites/duster_anim.txt4
-rw-r--r--res/sprites/kuma_anim.txt4
-rw-r--r--res/sprites/lucas_anim.txt4
-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
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
48barking[up_right]: 5,37,45,37,45,37,45 48barking[up_right]: 5,37,45,37,45,37,45
49barking[right]: 6,38,46,38,46,38,46 49barking[right]: 6,38,46,38,46,38,46
50barking[down_right]: 7,39,47,39,47,39,47 50barking[down_right]: 7,39,47,39,47,39,47
51climb.[up]: 240,241,242,243,244,245,246,247,248,249,250,251,252 51climb[up]: 240,241,242,243,244,245,246,247,248,249,250,251,252
52climb.[down]: 253,254,255,256,257,258,259,260,261,262,263,264,265 \ No newline at end of file 52climb[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
40run[up_right]: 77,85,93,101,109 40run[up_right]: 77,85,93,101,109
41run[right]: 78,86,94,102,110 41run[right]: 78,86,94,102,110
42run[down_right]: 79,87,95,103,111 42run[down_right]: 79,87,95,103,111
43climb.[up]: 200,201,202,206,207,208,203,204,205,206,207,208 43climb[up]: 200,201,202,206,207,208,203,204,205,206,207,208
44climb.[down]: 200,201,202,206,207,208,203,204,205,206,207,208 \ No newline at end of file 44climb[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
48talk[up_right]: 37,45 48talk[up_right]: 37,45
49talk[right]: 38,46 49talk[right]: 38,46
50talk[down_right]: 39,47 50talk[down_right]: 39,47
51climb.[up]: 257,258,259,263,264,265,260,261,262,263,264,265 51climb[up]: 257,258,259,263,264,265,260,261,262,263,264,265
52climb.[down]: 257,258,259,263,264,265,260,261,262,263,264,265 \ No newline at end of file 52climb[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
42run[down_right]: 74,82,90,98 42run[down_right]: 74,82,90,98
43lightning_electrocute![down]: 116,117,118,116,117,118 43lightning_electrocute![down]: 116,117,118,116,117,118
44lightning_collapse![down]: 119,120,121,122 44lightning_collapse![down]: 119,120,121,122
45climb.[up]: 123,124,125,128,127,127,129,130,131,128,127,126 45climb[up]: 123,124,125,128,127,127,129,130,131,128,127,126
46climb.[down]: 123,124,125,128,127,127,129,130,131,128,127,126 \ No newline at end of file 46climb[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
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