Mercurial > touhou
diff src/th06/ecl_vm.rs @ 690:eecb8626f472
ecl_vm: implement SetBulletLaunchOffset.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 17 Aug 2019 14:04:59 +0200 |
parents | 1adecaddf442 |
children | f5d85a646975 |
line wrap: on
line diff
--- a/src/th06/ecl_vm.rs +++ b/src/th06/ecl_vm.rs @@ -1,7 +1,7 @@ //! ECL runner. use crate::th06::ecl::{Ecl, SubInstruction}; -use crate::th06::enemy::{Enemy, BulletAttributes}; +use crate::th06::enemy::{Enemy, BulletAttributes, Offset}; use crate::util::prng::Prng; use std::cell::RefCell; use std::rc::Rc; @@ -513,15 +513,17 @@ impl EclRunner { } // 47 SubInstruction::SetSpeed(speed) => { + let speed = self.get_f32(speed); let mut enemy = self.enemy.borrow_mut(); enemy.update_mode = 0; - enemy.speed = self.get_f32(speed); + enemy.speed = speed; } // 48 SubInstruction::SetAcceleration(acceleration) => { + let acceleration = self.get_f32(acceleration); let mut enemy = self.enemy.borrow_mut(); enemy.update_mode = 0; - enemy.acceleration = self.get_f32(acceleration); + enemy.acceleration = acceleration; } // 49 SubInstruction::SetRandomAngle(min_angle, max_angle) => { @@ -643,13 +645,14 @@ impl EclRunner { enemy.fire(bullet_attributes=bullet_attributes) } */ + // 81 - /* - SubInstruction::SetBulletLaunchOffset(x, y, z) => { + SubInstruction::SetBulletLaunchOffset(dx, dy, dz) => { + let (dx, dy, dz) = (self.get_f32(dx), self.get_f32(dy), self.get_f32(dz)); let mut enemy = self.enemy.borrow_mut(); - enemy.bullet_launch_offset = (self._getval(x), self._getval(y), self._getval(z)); + enemy.bullet_offset = Offset { dx, dy }; } - */ + // 82 // TODO: correct but how to implement that in a rusty way? /*