# HG changeset patch # User Gauvain "GovanifY" Roussel-Tarbouriech # Date 1565635822 -7200 # Node ID 3e4cc64a254da0a1151a194b549b7ea46bf1c82c # Parent 81ad01910f4b72cf83a72e0bc3944c8f9b0a9941 ecl_vm: more instructions. diff --git a/src/th06/ecl.rs b/src/th06/ecl.rs --- a/src/th06/ecl.rs +++ b/src/th06/ecl.rs @@ -265,7 +265,7 @@ declare_sub_instructions!{ 104 => fn SetCollidable(collidable: i32), 105 => fn SetDamageable(damageable: i32), 106 => fn PlaySound(index: i32), - 107 => fn SetDeathFlags(death_flags: i32), + 107 => fn SetDeathFlags(death_flags: u32), 108 => fn SetDeathCallback(sub: i32), 109 => fn MemoryWriteInt(value: i32, index: i32), 111 => fn SetLife(life: i32), 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 @@ -552,11 +552,39 @@ impl EclRunner { // 103 SubInstruction::SetHitbox(width, height, depth) => { - assert_eq!(depth, 32.); let mut enemy = self.enemy.borrow_mut(); enemy.set_hitbox(width, height); } + // 104 + SubInstruction::SetCollidable(collidable) => { + // TODO: me and my siblings(105, 107) are implemented as a single variable in the touhou 6 + // original engine. While our behaviour seems correct we might want to implement + // that as a single variable + let mut enemy = self.enemy.borrow_mut(); + enemy.collidable = (collidable&1) != 0; + } + + // 105 + SubInstruction::SetDamageable(damageable) => { + let mut enemy = self.enemy.borrow_mut(); + enemy.damageable = (damageable&1) != 0; + } + + // 106 + /* + SubInstruction::PlaySound(index) => { + let mut enemy = self.enemy.borrow_mut(); + enemy.play_sound(index); + } + */ + + // 107 + SubInstruction::SetDeathFlags(death_flags) => { + let mut enemy = self.enemy.borrow_mut(); + enemy.death_flags = death_flags; + } + _ => unimplemented!() } }