Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ AutoStory::~AutoStory(){
STARTPOINT_MAINSTORY.remove_listener(*this);
ENDPOINT_MAINSTORY.remove_listener(*this);
ENABLE_TEST_CHECKPOINTS.remove_listener(*this);
ENABLE_TEST_REALIGN.remove_listener(*this);
ENABLE_MISC_TEST.remove_listener(*this);
TEST_PBF_LEFT_JOYSTICK.remove_listener(*this);
TEST_PBF_JOYSTICK2.remove_listener(*this);
Expand Down Expand Up @@ -570,36 +569,6 @@ AutoStory::AutoStory()
LockMode::UNLOCK_WHILE_RUNNING,
11
)
, ENABLE_TEST_REALIGN(
"<b>TEST: realign_player():</b>",
LockMode::UNLOCK_WHILE_RUNNING,
false
)
, REALIGN_MODE(
"--REALIGN_MODE:",
{
{PlayerRealignMode::REALIGN_NEW_MARKER, "realign_new", "Realign New Marker"},
{PlayerRealignMode::REALIGN_NO_MARKER, "realign_no", "Realign No Marker"},
{PlayerRealignMode::REALIGN_OLD_MARKER, "realign_old", "Realign Old Marker"},
},
LockMode::UNLOCK_WHILE_RUNNING,
PlayerRealignMode::REALIGN_NEW_MARKER
)
, X_REALIGN(
"--X_REALIGN:<br>x = 0 : left, x = 128 : neutral, x = 255 : right.",
LockMode::UNLOCK_WHILE_RUNNING,
128
)
, Y_REALIGN(
"--Y_REALIGN:<br>y = 0 : up, y = 128 : neutral, y = 255 : down.",
LockMode::UNLOCK_WHILE_RUNNING,
128
)
, REALIGN_DURATION(
"--REALIGN_DURATION",
LockMode::UNLOCK_WHILE_RUNNING,
0
)
, ENABLE_MISC_TEST(
"<b>TEST: Miscellaneous test code:</b>",
LockMode::UNLOCK_WHILE_RUNNING,
Expand All @@ -616,22 +585,22 @@ AutoStory::AutoStory()
false
)
, X_MOVE(
"--X_MOVE:<br>x = 0 : left, x = 128 : neutral, x = 255 : right.",
"--X_MOVE:<br>x = -1 : left, x = 0 : neutral, x = +1 : right.",
LockMode::UNLOCK_WHILE_RUNNING,
128
0
)
, Y_MOVE(
"--Y_MOVE:<br>y = 0 : up, y = 128 : neutral, y = 255 : down.",
"--Y_MOVE:<br>y = -1 : down, y = 0 : neutral, y = +1 : up.",
LockMode::UNLOCK_WHILE_RUNNING,
128
0
)
, HOLD_TICKS(
"--HOLD_TICKS:",
, HOLD(
"--HOLD (ms):",
LockMode::UNLOCK_WHILE_RUNNING,
0
)
, RELEASE_TICKS(
"--RELEASE_TICKS:",
, RELEASE(
"--RELEASE (ms):",
LockMode::UNLOCK_WHILE_RUNNING,
0
)
Expand All @@ -641,22 +610,22 @@ AutoStory::AutoStory()
false
)
, X_MOVE2(
"--X_MOVE:<br>x = 0 : left, x = 128 : neutral, x = 255 : right.",
"--X_MOVE:<br>x = -1 : left, x = 0 : neutral, x = +1 : right.",
LockMode::UNLOCK_WHILE_RUNNING,
128
0
)
, Y_MOVE2(
"--Y_MOVE:<br>y = 0 : up, y = 128 : neutral, y = 255 : down.",
"--Y_MOVE:<br>y = -1 : down, y = 0 : neutral, y = +1 : up.",
LockMode::UNLOCK_WHILE_RUNNING,
128
0
)
, HOLD_TICKS2(
"--HOLD_TICKS:",
, HOLD2(
"--HOLD (ms):",
LockMode::UNLOCK_WHILE_RUNNING,
0
)
, RELEASE_TICKS2(
"--RELEASE_TICKS:",
, RELEASE2(
"--RELEASE (ms):",
LockMode::UNLOCK_WHILE_RUNNING,
0
)
Expand Down Expand Up @@ -746,14 +715,14 @@ AutoStory::AutoStory()
PA_ADD_OPTION(TEST_PBF_LEFT_JOYSTICK);
PA_ADD_OPTION(X_MOVE);
PA_ADD_OPTION(Y_MOVE);
PA_ADD_OPTION(HOLD_TICKS);
PA_ADD_OPTION(RELEASE_TICKS);
PA_ADD_OPTION(HOLD);
PA_ADD_OPTION(RELEASE);

PA_ADD_OPTION(TEST_PBF_JOYSTICK2);
PA_ADD_OPTION(X_MOVE2);
PA_ADD_OPTION(Y_MOVE2);
PA_ADD_OPTION(HOLD_TICKS2);
PA_ADD_OPTION(RELEASE_TICKS2);
PA_ADD_OPTION(HOLD2);
PA_ADD_OPTION(RELEASE2);

PA_ADD_OPTION(ENABLE_TEST_CHECKPOINTS);
PA_ADD_OPTION(START_CHECKPOINT);
Expand All @@ -762,14 +731,8 @@ AutoStory::AutoStory()
PA_ADD_OPTION(START_LOOP);
PA_ADD_OPTION(END_LOOP);

// PA_ADD_OPTION(ENABLE_TEST_REALIGN);
// PA_ADD_OPTION(REALIGN_MODE);
// PA_ADD_OPTION(X_REALIGN);
// PA_ADD_OPTION(Y_REALIGN);
// PA_ADD_OPTION(REALIGN_DURATION);

PA_ADD_OPTION(ENABLE_MISC_TEST);
// PA_ADD_OPTION(FORWARD_TICKS);
PA_ADD_OPTION(m_advanced_options_end);
}

Expand Down Expand Up @@ -821,7 +784,6 @@ AutoStory::AutoStory()
ENABLE_ADVANCED_MODE.add_listener(*this);

ENABLE_TEST_CHECKPOINTS.add_listener(*this);
ENABLE_TEST_REALIGN.add_listener(*this);
ENABLE_MISC_TEST.add_listener(*this);
TEST_PBF_LEFT_JOYSTICK.add_listener(*this);
TEST_PBF_JOYSTICK2.add_listener(*this);
Expand Down Expand Up @@ -876,17 +838,6 @@ void AutoStory::on_config_value_changed(void* object){
END_LOOP.set_visibility(ConfigOptionState::DISABLED);
}

if (ENABLE_TEST_REALIGN){
REALIGN_MODE.set_visibility(ConfigOptionState::ENABLED);
X_REALIGN.set_visibility(ConfigOptionState::ENABLED);
Y_REALIGN.set_visibility(ConfigOptionState::ENABLED);
REALIGN_DURATION.set_visibility(ConfigOptionState::ENABLED);
}else{
REALIGN_MODE.set_visibility(ConfigOptionState::DISABLED);
X_REALIGN.set_visibility(ConfigOptionState::DISABLED);
Y_REALIGN.set_visibility(ConfigOptionState::DISABLED);
REALIGN_DURATION.set_visibility(ConfigOptionState::DISABLED);
}

if (ENABLE_MISC_TEST){
FORWARD_TICKS.set_visibility(ConfigOptionState::ENABLED);
Expand All @@ -897,25 +848,25 @@ void AutoStory::on_config_value_changed(void* object){
if (TEST_PBF_LEFT_JOYSTICK){
X_MOVE.set_visibility(ConfigOptionState::ENABLED);
Y_MOVE.set_visibility(ConfigOptionState::ENABLED);
HOLD_TICKS.set_visibility(ConfigOptionState::ENABLED);
RELEASE_TICKS.set_visibility(ConfigOptionState::ENABLED);
HOLD.set_visibility(ConfigOptionState::ENABLED);
RELEASE.set_visibility(ConfigOptionState::ENABLED);
}else{
X_MOVE.set_visibility(ConfigOptionState::DISABLED);
Y_MOVE.set_visibility(ConfigOptionState::DISABLED);
HOLD_TICKS.set_visibility(ConfigOptionState::DISABLED);
RELEASE_TICKS.set_visibility(ConfigOptionState::DISABLED);
HOLD.set_visibility(ConfigOptionState::DISABLED);
RELEASE.set_visibility(ConfigOptionState::DISABLED);
}

if (TEST_PBF_JOYSTICK2){
X_MOVE2.set_visibility(ConfigOptionState::ENABLED);
Y_MOVE2.set_visibility(ConfigOptionState::ENABLED);
HOLD_TICKS2.set_visibility(ConfigOptionState::ENABLED);
RELEASE_TICKS2.set_visibility(ConfigOptionState::ENABLED);
HOLD2.set_visibility(ConfigOptionState::ENABLED);
RELEASE2.set_visibility(ConfigOptionState::ENABLED);
}else{
X_MOVE2.set_visibility(ConfigOptionState::DISABLED);
Y_MOVE2.set_visibility(ConfigOptionState::DISABLED);
HOLD_TICKS2.set_visibility(ConfigOptionState::DISABLED);
RELEASE_TICKS2.set_visibility(ConfigOptionState::DISABLED);
HOLD2.set_visibility(ConfigOptionState::DISABLED);
RELEASE2.set_visibility(ConfigOptionState::DISABLED);
}


Expand Down Expand Up @@ -1261,12 +1212,12 @@ void AutoStory::test_code(SingleSwitchProgramEnvironment& env, ProControllerCont
}

if (TEST_PBF_LEFT_JOYSTICK){
pbf_move_left_joystick_old(context, X_MOVE, Y_MOVE, HOLD_TICKS * 8ms, RELEASE_TICKS * 8ms);
pbf_move_left_joystick(context, {X_MOVE, Y_MOVE}, Milliseconds(HOLD), Milliseconds(RELEASE));
return;
}

if (TEST_PBF_JOYSTICK2){
pbf_move_left_joystick_old(context, X_MOVE2, Y_MOVE2, HOLD_TICKS2 * 8ms, RELEASE_TICKS2 * 8ms);
pbf_move_left_joystick(context, {X_MOVE2, Y_MOVE2}, Milliseconds(HOLD2), Milliseconds(RELEASE2));
return;
}

Expand All @@ -1276,14 +1227,7 @@ void AutoStory::test_code(SingleSwitchProgramEnvironment& env, ProControllerCont
GO_HOME_WHEN_DONE.run_end_of_program(context);
return;
}


if (ENABLE_TEST_REALIGN){
// clear realign marker
// realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 128, 128, 0);
realign_player(env.program_info(), env.console, context, REALIGN_MODE, X_REALIGN, Y_REALIGN, REALIGN_DURATION);
return;
}

if (ENABLE_MISC_TEST){
// walk_forward_while_clear_front_path(env.program_info(), env.console, context, FORWARD_TICKS);
Expand Down Expand Up @@ -1325,7 +1269,7 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex


// test code
if (TEST_FLYPOINT_LOCATIONS || TEST_MOVE_CURSOR_OFFSET_FROM_FLYPOINT || ENABLE_TEST_CHECKPOINTS || ENABLE_TEST_REALIGN || ENABLE_MISC_TEST || TEST_PBF_LEFT_JOYSTICK || TEST_PBF_JOYSTICK2 || TEST_CHANGE_DIRECTION || TEST_CURRENT_DIRECTION){
if (TEST_FLYPOINT_LOCATIONS || TEST_MOVE_CURSOR_OFFSET_FROM_FLYPOINT || ENABLE_TEST_CHECKPOINTS || ENABLE_MISC_TEST || TEST_PBF_LEFT_JOYSTICK || TEST_PBF_JOYSTICK2 || TEST_CHANGE_DIRECTION || TEST_CURRENT_DIRECTION){
test_code(env, context);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,21 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste
SimpleIntegerOption<uint16_t> START_LOOP;
SimpleIntegerOption<uint16_t> END_LOOP;

BooleanCheckBoxOption ENABLE_TEST_REALIGN;
EnumDropdownOption<PlayerRealignMode> REALIGN_MODE;
SimpleIntegerOption<uint8_t> X_REALIGN;
SimpleIntegerOption<uint8_t> Y_REALIGN;
SimpleIntegerOption<uint16_t> REALIGN_DURATION;

BooleanCheckBoxOption ENABLE_MISC_TEST;
SimpleIntegerOption<uint16_t> FORWARD_TICKS;

BooleanCheckBoxOption TEST_PBF_LEFT_JOYSTICK;
SimpleIntegerOption<uint8_t> X_MOVE;
SimpleIntegerOption<uint8_t> Y_MOVE;
SimpleIntegerOption<uint16_t> HOLD_TICKS;
SimpleIntegerOption<uint16_t> RELEASE_TICKS;
FloatingPointOption X_MOVE;
FloatingPointOption Y_MOVE;
SimpleIntegerOption<uint64_t> HOLD;
SimpleIntegerOption<uint64_t> RELEASE;

BooleanCheckBoxOption TEST_PBF_JOYSTICK2;
SimpleIntegerOption<uint8_t> X_MOVE2;
SimpleIntegerOption<uint8_t> Y_MOVE2;
SimpleIntegerOption<uint16_t> HOLD_TICKS2;
SimpleIntegerOption<uint16_t> RELEASE_TICKS2;
FloatingPointOption X_MOVE2;
FloatingPointOption Y_MOVE2;
SimpleIntegerOption<uint64_t> HOLD2;
SimpleIntegerOption<uint64_t> RELEASE2;

BooleanCheckBoxOption TEST_CURRENT_DIRECTION;
BooleanCheckBoxOption TEST_CHANGE_DIRECTION;
Expand Down
Loading