From 36b2025fc452d4608a0a0c4e1dfe012ef1a2e9bb Mon Sep 17 00:00:00 2001 From: Alula Date: Fri, 4 Dec 2020 13:35:30 +0100 Subject: [PATCH] fix live debugger not preserving second player state --- src/live_debugger.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/live_debugger.rs b/src/live_debugger.rs index 6859f65..d44d82b 100644 --- a/src/live_debugger.rs +++ b/src/live_debugger.rs @@ -91,6 +91,7 @@ impl LiveDebugger { speed = 1.0 } + #[allow(clippy::float_cmp)] if state.settings.speed != speed { state.set_speed(speed); } @@ -140,6 +141,8 @@ impl LiveDebugger { match GameScene::new(state, ctx, self.selected_stage as usize) { Ok(mut scene) => { scene.inventory_player1 = game_scene.inventory_player1.clone(); + scene.inventory_player2 = game_scene.inventory_player2.clone(); + scene.player1 = game_scene.player1.clone(); scene.player1.x = (scene.stage.map.width / 2 * 16 * 0x200) as isize; scene.player1.y = (scene.stage.map.height / 2 * 16 * 0x200) as isize; @@ -148,6 +151,14 @@ impl LiveDebugger { scene.player1.life = scene.player1.max_life; } + scene.player2 = game_scene.player2.clone(); + scene.player2.x = (scene.stage.map.width / 2 * 16 * 0x200) as isize; + scene.player2.y = (scene.stage.map.height / 2 * 16 * 0x200) as isize; + + if scene.player2.life == 0 { + scene.player2.life = scene.player1.max_life; + } + state.next_scene = Some(Box::new(scene)); } Err(e) => {