summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--res/sprites/boney_anim.txt16
-rw-r--r--res/sprites/duster_anim.txt10
-rw-r--r--res/sprites/kuma_anim.txt16
-rw-r--r--res/sprites/lucas_anim.txt10
-rw-r--r--src/animation_system.cpp12
5 files changed, 36 insertions, 28 deletions
diff --git a/res/sprites/boney_anim.txt b/res/sprites/boney_anim.txt index 65901b9..039db95 100644 --- a/res/sprites/boney_anim.txt +++ b/res/sprites/boney_anim.txt
@@ -1,13 +1,13 @@
1../res/sprites/boney.png 1../res/sprites/boney.png
2../res/sprites/boney_frames.txt 2../res/sprites/boney_frames.txt
3still[down]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,104,96,104 3still[down]: 0#64,96,104,96,104
4still[down_left]: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,97,105,97,105 4still[down_left]: 1#64,97,105,97,105
5still[left]: 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,98,106,98,106 5still[left]: 2#64,98,106,98,106
6still[up_left]: 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,99,107,99,107 6still[up_left]: 3#64,99,107,99,107
7still[up]: 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,100,108,100,108 7still[up]: 4#64,100,108,100,108
8still[up_right]: 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,101,109,101,109 8still[up_right]: 5#64,101,109,101,109
9still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,102,110,102,110 9still[right]: 6#64,102,110,102,110
10still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,103,111,103,111 10still[down_right]: 7#64,103,111,103,111
11frozen[down]: 0 11frozen[down]: 0
12frozen[down_left]: 1 12frozen[down_left]: 1
13frozen[left]: 2 13frozen[left]: 2
diff --git a/res/sprites/duster_anim.txt b/res/sprites/duster_anim.txt index 9c1ed3f..6853ed8 100644 --- a/res/sprites/duster_anim.txt +++ b/res/sprites/duster_anim.txt
@@ -1,13 +1,13 @@
1../res/sprites/duster.png 1../res/sprites/duster.png
2../res/sprites/duster_frames.txt 2../res/sprites/duster_frames.txt
3still[down]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,212,0,212 3still[down]: 0#57,212,0,212
4still[down_left]: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,213,1,213 4still[down_left]: 1#57,213,1,213
5still[left]: 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,214,2,214 5still[left]: 2#57,214,2,214
6still[up_left]: 3 6still[up_left]: 3
7still[up]: 4 7still[up]: 4
8still[up_right]: 5 8still[up_right]: 5
9still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,215,6,215 9still[right]: 6#57,215,6,215
10still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,216,7,216 10still[down_right]: 7#57,216,7,216
11frozen[down]: 0 11frozen[down]: 0
12frozen[down_left]: 1 12frozen[down_left]: 1
13frozen[left]: 2 13frozen[left]: 2
diff --git a/res/sprites/kuma_anim.txt b/res/sprites/kuma_anim.txt index bd56fe6..b60675f 100644 --- a/res/sprites/kuma_anim.txt +++ b/res/sprites/kuma_anim.txt
@@ -1,13 +1,13 @@
1../res/sprites/kumatora.png 1../res/sprites/kumatora.png
2../res/sprites/kumatora_frames.txt 2../res/sprites/kumatora_frames.txt
3still[down]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,136,144,152,144,152,144,152,144,136 3still[down]: 0#80,128,136,144,152,144,152,144,152,144,136
4still[down_left]: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,137,145,153,145,153,145,153,145,137 4still[down_left]: 1#80,129,137,145,153,145,153,145,153,145,137
5still[left]: 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,130,138,146,154,146,154,146,154,146,138 5still[left]: 2#80,130,138,146,154,146,154,146,154,146,138
6still[up_left]: 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,131,139,147,155,147,155,147,155,147,139 6still[up_left]: 3#80,131,139,147,155,147,155,147,155,147,139
7still[up]: 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,132,140,148,156,148,156,148,156,148,140 7still[up]: 4#80,132,140,148,156,148,156,148,156,148,140
8still[up_right]: 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,133,141,149,157,149,157,149,157,149,141 8still[up_right]: 5#80,133,141,149,157,149,157,149,157,149,141
9still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,134,142,150,158,150,158,150,158,150,142 9still[right]: 6#80,134,142,150,158,150,158,150,158,150,142
10still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,135,143,151,159,151,159,151,159,151,143 10still[down_right]: 7#80,135,143,151,159,151,159,151,159,151,143
11frozen[down]: 0 11frozen[down]: 0
12frozen[down_left]: 1 12frozen[down_left]: 1
13frozen[left]: 2 13frozen[left]: 2
diff --git a/res/sprites/lucas_anim.txt b/res/sprites/lucas_anim.txt index 3c2906c..0579e94 100644 --- a/res/sprites/lucas_anim.txt +++ b/res/sprites/lucas_anim.txt
@@ -1,13 +1,13 @@
1../res/sprites/lucas.png 1../res/sprites/lucas.png
2../res/sprites/lucas_frames.txt 2../res/sprites/lucas_frames.txt
3still[down]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,0,189 3still[down]: 0#53,189,0,189
4still[down_left]: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,190,1,190 4still[down_left]: 1#53,190,1,190
5still[left]: 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,191,2,191 5still[left]: 2#53,191,2,191
6still[up_left]: 3 6still[up_left]: 3
7still[up]: 4 7still[up]: 4
8still[up_right]: 5 8still[up_right]: 5
9still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,193,6,193 9still[right]: 6#53,193,6,193
10still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,192,7,192 10still[down_right]: 7#53,192,7,192
11frozen[down]: 0 11frozen[down]: 0
12frozen[down_left]: 1 12frozen[down_left]: 1
13frozen[left]: 2 13frozen[left]: 2
diff --git a/src/animation_system.cpp b/src/animation_system.cpp index 2c2c6a5..b57816b 100644 --- a/src/animation_system.cpp +++ b/src/animation_system.cpp
@@ -65,7 +65,7 @@ void AnimationSystem::initSprite(int spriteId, std::string_view filename) {
65 std::string animLine; 65 std::string animLine;
66 std::getline(datafile, animLine); // blank 66 std::getline(datafile, animLine); // blank
67 while (std::getline(datafile, animLine)) { 67 while (std::getline(datafile, animLine)) {
68 std::regex re(R"(([a-z!._]+)\[([a-z_]+)\]: ([0-9,]+))"); 68 std::regex re(R"(([a-z!._]+)\[([a-z_]+)\]: ([0-9,#]+))");
69 std::smatch m; 69 std::smatch m;
70 std::regex_match(animLine, m, re); 70 std::regex_match(animLine, m, re);
71 71
@@ -73,7 +73,15 @@ void AnimationSystem::initSprite(int spriteId, std::string_view filename) {
73 Animation anim; 73 Animation anim;
74 auto framestrs = splitStr<std::list<std::string>>(m[3], ","); 74 auto framestrs = splitStr<std::list<std::string>>(m[3], ",");
75 for (const std::string& f : framestrs) { 75 for (const std::string& f : framestrs) {
76 anim.frameIndices.push_back(std::stoi(f)); 76 int times = 1;
77 size_t repeat_it = f.find("#");
78 if (repeat_it != std::string::npos) {
79 times = std::stoi(f.substr(repeat_it + 1));
80 }
81
82 for (int i=0; i<times; i++) {
83 anim.frameIndices.push_back(std::stoi(f));
84 }
77 } 85 }
78 86
79 if (animName.back() == '!') { 87 if (animName.back() == '!') {