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

Function testJump

tests/move_route.cpp:543–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

541
542template <bool success, bool repeat, bool skip, bool end>
543static void testJump(lcf::rpg::MoveCommand::Code code, int x, int y, int dir, int face, int tx, int ty, int tdir, int tface, int px = 0, int py = 0) {
544 Main_Data::game_player->SetX(px);
545 Main_Data::game_player->SetY(py);
546
547 auto ch = MoveRouteVehicle();
548 ch.SetX(x);
549 ch.SetY(y);
550 ch.SetDirection(dir);
551 ch.SetFacing(face);
552 ch.SetAllowMovement(success);
553
554 auto mr = MakeRoute(static_cast<int>(lcf::rpg::MoveCommand::Code::begin_jump), repeat, skip);
555 if (code != lcf::rpg::MoveCommand::Code::end_jump) {
556 lcf::rpg::MoveCommand mc;
557 mc.command_id = static_cast<int>(code);
558 mr.move_commands.push_back(mc);
559 }
560 if (end) {
561 lcf::rpg::MoveCommand mc;
562 mc.command_id = static_cast<int>(lcf::rpg::MoveCommand::Code::end_jump);
563 mr.move_commands.push_back(mc);
564 }
565 auto num_cmds = static_cast<int>(mr.move_commands.size());
566
567 CAPTURE(code);
568 CAPTURE(x);
569 CAPTURE(y);
570 CAPTURE(dir);
571 CAPTURE(face);
572 CAPTURE(tx);
573 CAPTURE(ty);
574 CAPTURE(tdir);
575 CAPTURE(tface);
576 CAPTURE(px);
577 CAPTURE(py);
578 CAPTURE(success);
579 CAPTURE(repeat);
580 CAPTURE(skip);
581
582 auto dx = tx - x;
583 auto dy = ty - y;
584
585 ch.ForceMoveRoute(mr, 3);
586 testMoveRouteJump(ch, x, y, 0, false, 0, 0, dir, face, false, 3, 0xFFFF, 64, 0, true, false, mr);
587
588 if (!end) {
589 ForceUpdate(ch);
590 if (repeat) {
591 testMoveRouteJump(ch, x, y, 0, false, 0, 0, dir, face, false, 3, 0xFFFF + 1, 64, 0, true, true, mr);
592 } else {
593 testMoveRouteJump(ch, x, y, 0, false, 0, 0, dir, face, false, 2, 0xFFFF + 1, 128, num_cmds, false, false, mr);
594 }
595
596 return;
597 }
598
599 if (success) {
600 bool repeated = false;

Callers

nothing calls this directly

Calls 12

MoveRouteVehicleClass · 0.85
MakeRouteFunction · 0.85
testMoveRouteJumpFunction · 0.85
testMoveRouteMoveFunction · 0.85
SetDirectionMethod · 0.80
SetFacingMethod · 0.80
ForceMoveRouteMethod · 0.80
ForceUpdateFunction · 0.70
SetXMethod · 0.45
SetYMethod · 0.45
SetAllowMovementMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected