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

Function testMoving

tests/game_character_anim.cpp:181–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181static void testMoving(AnimType at, int speed) {
182 const MockGame mg(map_id);
183
184 auto& ch = GetEvent(at, speed);
185
186 const auto limit = Game_Character::GetStationaryAnimFrames(ch.GetMoveSpeed());
187
188 CAPTURE(at);
189 CAPTURE(speed);
190
191 // When event is moving
192 if (at == lcf::rpg::EventPage::AnimType_spin) {
193 // Continues spinning even when moving
194 testAnimSpin(ch, true, false);
195 return;
196 }
197
198 for (int i = 0; i < 255; ++i) {
199 // HACK To make stop count increment to 0 each frame to emulate movement
200 // FIXME: Verify this matches movement
201 ch.SetStopCount(-1);
202
203 if (ch.IsAnimated()) {
204 auto count = i % limit;
205 auto frame = ((i / limit) + 1) % 4;
206 testChar(ch, count, frame);
207 } else {
208 testChar(ch, 0, 1);
209 }
210 ForceUpdate(ch);
211 }
212}
213
214static void testCenterStep(AnimType at, int speed, int frame) {
215 const MockGame mg(map_id);

Callers 1

Calls 6

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

Tested by

no test coverage detected