MCPcopy Create free account
hub / github.com/EasyRPG/Player / testCenterStep

Function testCenterStep

tests/game_character_anim.cpp:214–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214static void testCenterStep(AnimType at, int speed, int frame) {
215 const MockGame mg(map_id);
216
217 auto& ch = GetEvent(at, speed);
218
219 const auto slimit = Game_Character::GetStationaryAnimFrames(ch.GetMoveSpeed());
220 const auto climit = Game_Character::GetContinuousAnimFrames(ch.GetMoveSpeed());
221
222 CAPTURE(at);
223 CAPTURE(speed);
224 CAPTURE(frame);
225
226 if (at == lcf::rpg::EventPage::AnimType_spin) {
227 // Spins regardless of frame
228 testAnimSpin(ch);
229 return;
230 }
231
232 // When event has left or right step, they will always animate back to center step regardless of movement or not
233 if (frame == lcf::rpg::EventPage::Frame_left || frame == lcf::rpg::EventPage::Frame_right) {
234 for (int i = 0; i < climit; ++i) {
235 testChar(ch, ch.IsAnimated() ? i : 0, frame);
236 ForceUpdate(ch);
237 }
238 if (ch.IsAnimated()) {
239 frame = (frame + 1) % 4;
240 }
241 }
242
243 for (int i = 0; i < slimit; ++i) {
244 testChar(ch, ch.IsAnimated() ? i : 0, frame);
245 ForceUpdate(ch);
246 }
247
248 if (ch.IsAnimated()) {
249 if (ch.IsContinuous()) {
250 testChar(ch, slimit, frame);
251 } else {
252 testChar(ch, slimit - 1, frame);
253 }
254 } else {
255 testChar(ch, 0, frame);
256 }
257}
258
259TEST_CASE("Flags") {
260 const MockGame mg(map_id);

Callers 1

Calls 6

testAnimSpinFunction · 0.85
GetMoveSpeedMethod · 0.80
IsAnimatedMethod · 0.80
IsContinuousMethod · 0.80
testCharFunction · 0.70
ForceUpdateFunction · 0.70

Tested by

no test coverage detected