Mercurial > touhou
changeset 674:3e4cc64a254d
ecl_vm: more instructions.
author | Gauvain "GovanifY" Roussel-Tarbouriech <gauvain@govanify.com> |
---|---|
date | Mon, 12 Aug 2019 20:50:22 +0200 |
parents | 81ad01910f4b |
children | 6be3320a1cb3 |
files | src/th06/ecl.rs src/th06/ecl_vm.rs |
diffstat | 2 files changed, 30 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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),
--- 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!() } }