fix live debugger not preserving second player state

This commit is contained in:
Alula 2020-12-04 13:35:30 +01:00
parent a6967eb6c7
commit 36b2025fc4
No known key found for this signature in database
GPG Key ID: 3E00485503A1D8BA
1 changed files with 11 additions and 0 deletions

View File

@ -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) => {