# HG changeset patch # User Emmanuel Gil Peyrot # Date 1566520641 -7200 # Node ID 05e0425a8bc558bfef8e2287d0a6149af1882bce # Parent 600eb0a69b25d8dfc666b6f93597c44e237e8396 ecl_vm: enable SetDeathCallback. diff --git a/src/th06/ecl_vm.rs b/src/th06/ecl_vm.rs --- a/src/th06/ecl_vm.rs +++ b/src/th06/ecl_vm.rs @@ -883,12 +883,10 @@ impl EclRunner { enemy.death_flags = death_flags; } // 108 - /* SubInstruction::SetDeathCallback(sub) => { let mut enemy = self.enemy.borrow_mut(); - enemy.death_callback.enable(self.switch_to_sub, (sub,)); + enemy.death_callback = Some(sub); } - */ // 109 SubInstruction::MemoryWriteInt(value, index) => { diff --git a/src/th06/enemy.rs b/src/th06/enemy.rs --- a/src/th06/enemy.rs +++ b/src/th06/enemy.rs @@ -57,8 +57,7 @@ impl std::ops::Sub for Positio } } -#[derive(Debug, Clone)] -struct Callback; +type Callback = i32; #[derive(Debug, Clone)] /// XXX @@ -251,10 +250,10 @@ pub struct Enemy { pub(crate) screen_box: Option<(f32, f32, f32, f32)>, // Callbacks. - death_callback: Option, - boss_callback: Option, - low_life_callback: Option, - timeout_callback: Option, + pub(crate) death_callback: Option, + pub(crate) boss_callback: Option, + pub(crate) low_life_callback: Option, + pub(crate) timeout_callback: Option, // Laser. pub(crate) laser_by_id: HashMap,