Mercurial > touhou
comparison src/th06/ecl_vm.rs @ 737:0977d479e37d
ecl_vm: Uncomment instruction 121 function 8.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 28 Dec 2019 22:56:32 +0100 |
parents | ff9651cfe1b0 |
children | 817c453b7223 |
comparison
equal
deleted
inserted
replaced
736:ff9651cfe1b0 | 737:0977d479e37d |
---|---|
1 //! ECL runner. | 1 //! ECL runner. |
2 | 2 |
3 use crate::th06::ecl::{Ecl, SubInstruction}; | 3 use crate::th06::ecl::{Ecl, SubInstruction}; |
4 use crate::th06::enemy::{Enemy, Offset}; | 4 use crate::th06::enemy::{Enemy, Offset, BulletAttributes}; |
5 use crate::util::prng::Prng; | 5 use crate::util::prng::Prng; |
6 use std::cell::RefCell; | 6 use std::cell::RefCell; |
7 use std::rc::Rc; | 7 use std::rc::Rc; |
8 | 8 |
9 macro_rules! gen_SetBulletAttributes { | 9 macro_rules! gen_SetBulletAttributes { |
1105 offset = (next_offset - 2.*std::f64::consts::PI) + offset; | 1105 offset = (next_offset - 2.*std::f64::consts::PI) + offset; |
1106 } | 1106 } |
1107 } | 1107 } |
1108 } | 1108 } |
1109 8 => { // Vampire Fantasy | 1109 8 => { // Vampire Fantasy |
1110 /* | 1110 let n = { |
1111 let mut n = 0: | 1111 let enemy = self.enemy.borrow(); |
1112 for bullet in game.bullets{ | 1112 let game = enemy.game.upgrade().unwrap(); |
1113 if bullet._bullet_type.state != 0 && bullet._bullet_type.state != 5 && (30. <= (bullet.sprites[0].additional_infos)->height) { | 1113 let mut game = game.borrow_mut(); |
1114 local_5c.pos[0] = local_bullet_vec->pos[0]; | 1114 let mut n = 0; |
1115 local_5c.pos[1] = local_bullet_vec->pos[1]; | 1115 for bullet in game.bullets.iter() { |
1116 local_5c.pos[2] = local_bullet_vec->pos[2]; | 1116 let mut bullet = bullet.borrow(); |
1117 local_5c.anim = 3; | 1117 // TODO: uncomment that one. |
1118 local_5c.sprite_index_offset = 1; | 1118 if bullet.state != 0 && bullet.state != 5 /* && (30. <= (bullet.sprites[0].additional_infos).height) */ { |
1119 fVar3 = prng_double(&PRNG_STATE); | 1119 let prng = enemy.prng.upgrade().unwrap(); |
1120 local_5c.launch_angle = (self.get_prng().borrow_mut().get_f64() * (2. * std::f64::consts::PI) - std::f64::consts::PI) as f32; | 1120 let random = prng.borrow_mut().get_f64(); |
1121 local_5c.speed = 0.00000000; | 1121 let launch_angle = (random * (2. * std::f64::consts::PI) - std::f64::consts::PI) as f32; |
1122 local_5c.bullets_per_shot = 1; | 1122 let mut attribs = BulletAttributes { |
1123 local_5c.nb_of_shots = 1; | 1123 // TODO: check if the z value of this pos is really used. |
1124 local_5c.flags = 8; | 1124 pos: bullet.pos, |
1125 local_5c.bullet_type = 1; | 1125 anim: 3, |
1126 bullet_fire(&local_5c,&ETAMA_ARRAY); | 1126 sprite_index_offset: 1, |
1127 launch_angle, | |
1128 speed: 0., | |
1129 angle: 0., | |
1130 speed2: 0., | |
1131 bullets_per_shot: 1, | |
1132 number_of_shots: 1, | |
1133 flags: 8, | |
1134 bullet_type: 1, | |
1135 extended_attributes: Default::default(), | |
1136 sound: None, | |
1137 }; | |
1138 attribs.fire(); | |
1139 n += 1 | |
1127 } | 1140 } |
1128 n += 1 | 1141 } |
1129 } | 1142 n |
1143 }; | |
1130 //TODO: this variable might not always be correct! it uses the argument in | 1144 //TODO: this variable might not always be correct! it uses the argument in |
1131 //th06: *(int *)(param_1 + 0x9b0) = local_60; | 1145 //th06: *(int *)(param_1 + 0x9b0) = local_60; |
1132 self._setval(-10004, n) | 1146 self.set_i32(-10004, n); |
1133 */ | |
1134 } | 1147 } |
1135 | 1148 |
1136 9 => { | 1149 9 => { |
1137 let mut rnd = self.get_prng().borrow_mut().get_f64(); | 1150 let mut rnd = self.get_prng().borrow_mut().get_f64(); |
1138 //TODO: the game does that | 1151 //TODO: the game does that |