Skip to content

Commit

Permalink
Fix practice states not working if it starts with the player on a button
Browse files Browse the repository at this point in the history
  • Loading branch information
oberien committed Jun 10, 2023
1 parent fcd734a commit dc08e5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions rtil/src/threads/ue/rebo/rebo_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ fn show_hud() {

#[rebo::function("Tas::set_all_cluster_speeds")]
fn set_all_cluster_speeds(speed: f32) {
// initialize before we change anything
let _ = &*ORIGINAL_MAP;
UeScope::with(|scope| {
for level in &*LEVELS.lock().unwrap() {
scope.get(level.level).set_speed(speed);
Expand Down
6 changes: 3 additions & 3 deletions tool/practice.re
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static mut CURRENT_PRACTICE = Practice {
location: Location { x: 0., y: 0., z: 0. },
rotation: Rotation { pitch: 0., yaw: 0., roll: 0. },
};
static mut CURRENT_PRACTICE_MAP = Tas::current_map();

fn press_buttons_until(buttons: int) {
let map = Tas::current_map();
Expand Down Expand Up @@ -64,18 +65,17 @@ static PRACTICE_COMPONENT = Component {
on_tick: fn() {},
on_yield: fn() {},
on_new_game: fn() {
CURRENT_PRACTICE_MAP = Tas::current_map();
Tas::set_all_cluster_speeds(999999999.);
Tas::set_level(CURRENT_PRACTICE.cluster);
Tas::set_rotation(CURRENT_PRACTICE.rotation);
Tas::set_location(CURRENT_PRACTICE.location);
Tas::set_velocity(Velocity { x: 0., y: 0., z: 0. });
Tas::set_acceleration(Acceleration { x: 0., y: 0., z: 0. });
},
on_level_change: fn(old: int, new: int) {},
on_reset: fn(old: int, new: int) {
Tas::set_level(0);
press_buttons_until(CURRENT_PRACTICE.button);
Tas::apply_map(Tas::current_map());
Tas::apply_map(CURRENT_PRACTICE_MAP);
Tas::set_rotation(CURRENT_PRACTICE.rotation);
Tas::set_location(CURRENT_PRACTICE.location);
Tas::set_velocity(Velocity { x: 0., y: 0., z: 0. });
Expand Down

0 comments on commit dc08e5d

Please sign in to comment.