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

Function testBoat

tests/game_character_anim.cpp:362–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362static void testBoat(Game_Vehicle::Type vt, AnimType at, int speed, bool move, bool jump, bool flying) {
363 const MockGame mg(map_id);
364
365 auto& ch = *mg.GetVehicle(vt);
366 if (flying) {
367 ch.SetFlying(flying);
368 }
369
370 auto limit = move ? 12 : 16;
371
372 CAPTURE(vt);
373 CAPTURE(at);
374 CAPTURE(speed);
375
376 if (vt == Game_Vehicle::Airship && !ch.IsFlying()) {
377 testAnimFixed(ch);
378 return;
379 }
380
381 if (jump) {
382 testAnimJump(ch);
383 return;
384 }
385
386 for (int i = 0; i < 255; ++i) {
387 if (move) {
388 // HACK To make stop count increment to 0 each frame to emulate movement
389 // FIXME: Verify this matches movement
390 ch.SetStopCount(-1);
391 }
392
393 auto count = i % limit;
394 auto frame = ((i / limit) + 1) % 4;
395 testChar(ch, count, frame);
396 ForceUpdate(ch);
397 }
398}
399
400TEST_CASE("BoatShipStanding") {
401 for (int speed = 1; speed <= 6; ++speed) {

Callers 1

Calls 8

testAnimFixedFunction · 0.85
testAnimJumpFunction · 0.85
SetFlyingMethod · 0.80
SetStopCountMethod · 0.80
testCharFunction · 0.70
ForceUpdateFunction · 0.70
GetVehicleMethod · 0.45
IsFlyingMethod · 0.45

Tested by

no test coverage detected