# HG changeset patch # User Gauvain "GovanifY" Roussel-Tarbouriech # Date 1572743238 -3600 # Node ID 5f00b2e0c06abf2d0850da05e0f509804cf49528 # Parent ca46b4312df19f89e2819f727fc62f2e90f26878 ecl_vm: remilia lasers done 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 @@ -1007,6 +1007,73 @@ impl EclRunner { self.frame.ints1[i] = knowledge[character][i]; } } + 7 => { // Remilia's lazer maze + // so what this does is kinda complex: 2 rounds of 3 subrounds of 8 shots, either + // laser or standard bullets depending on the argument passed. + // it is done in 2 steps: first we precalculate coordinates of the 8 shots for the first subround + // set the shot properties depending on difficulties and current round and then + // edit the coordinates for the next round + let rnd_pos = self.get_prng().borrow_mut().get_f64() * 2. * std::f64::consts::PI; + let enemy = self.enemy.borrow(); + for i in 0..2 { + let mut pos: [f64; 8*3] = [0.; 8*3]; + let mut offset = rnd_pos -((std::f64::consts::PI/8.)*7.); + let mut next_offset = -std::f64::consts::PI/4.; + if (i == 0) { + offset = rnd_pos -std::f64::consts::PI; + next_offset = std::f64::consts::PI/4.; + } + + // we calculate angle, speed and offset for the 8 shots + let mut offset_copy=offset; + for y in 0..8 { + pos[y * 3] = offset_copy.cos() * 32. + enemy.pos.x as f64; + pos[y * 3 + 1] = offset_copy.sin() * 32. + enemy.pos.y as f64; + pos[y * 3 + 2] = enemy.z as f64; + offset_copy += std::f64::consts::PI/4.; + } + + // 3 rounds of 8 shots + for z in 0..3 { + + let mut length = 112.; + // last subround + if (z == 2) {length = 480.;} + + for y in 0..8 { + /* + if (arg == 0) { + let (mut si, mut ged, mut ed) = (8, 20.,ed=430.); + if (LEVEL.rank < 2) {si=2; ged=28.; ed=length;} + laser_args.angle = pos[y * 3]; + laser_args.speed = pos[y * 3 + 1]; + laser_args.start_offset = pos[y * 3 + 2]; + laser_args.type = 1; + laser_args.sprite_index_offset = si; + laser_args.end_offset = offset; + laser_args.width = 0.; + laser_args.duration = 0; + laser_args.grazing_extra_duration = ged; + laser_args.end_duration = ed; + laser_args.UNK1 = z * 0x10 + 0x3c; + laser_args.grazing_delay = laser_args.end_duration; + fire_laser(&ETAMA_ARRAY,&laser_args); + } + else { + (enemy->bullet_attributes).pos[0] = pos[y * 3]; + (enemy->bullet_attributes).pos[1] = pos[y*3+1]; + (enemy->bullet_attributes).pos[2] = pos[y*3+2]; + bullet_fire(&enemy->bullet_attributes,&ETAMA_ARRAY); + } + */ + pos[y * 3] = offset.cos() * length + pos[y * 3]; + pos[y * 3 + 1] = offset.sin() * length + pos[y * 3 + 1]; + offset = offset + std::f64::consts::PI/4.; + } + offset = (next_offset - 2.*std::f64::consts::PI) + offset; + } + } + } 8 => { // Vampire Fantasy /* let mut n = 0: @@ -1033,6 +1100,7 @@ impl EclRunner { self._setval(-10004, n) */ } + 9 => { let mut rnd = self.get_prng().borrow_mut().get_f64(); //TODO: the game does that