comparison src/th06/ecl_vm.rs @ 732:5f00b2e0c06a

ecl_vm: remilia lasers done
author Gauvain "GovanifY" Roussel-Tarbouriech <gauvain@govanify.com>
date Sun, 03 Nov 2019 02:07:18 +0100
parents ca46b4312df1
children 770e5057f6bc
comparison
equal deleted inserted replaced
731:ca46b4312df1 732:5f00b2e0c06a
1005 let character = 0; 1005 let character = 0;
1006 for i in 1..=3 { 1006 for i in 1..=3 {
1007 self.frame.ints1[i] = knowledge[character][i]; 1007 self.frame.ints1[i] = knowledge[character][i];
1008 } 1008 }
1009 } 1009 }
1010 7 => { // Remilia's lazer maze
1011 // so what this does is kinda complex: 2 rounds of 3 subrounds of 8 shots, either
1012 // laser or standard bullets depending on the argument passed.
1013 // it is done in 2 steps: first we precalculate coordinates of the 8 shots for the first subround
1014 // set the shot properties depending on difficulties and current round and then
1015 // edit the coordinates for the next round
1016 let rnd_pos = self.get_prng().borrow_mut().get_f64() * 2. * std::f64::consts::PI;
1017 let enemy = self.enemy.borrow();
1018 for i in 0..2 {
1019 let mut pos: [f64; 8*3] = [0.; 8*3];
1020 let mut offset = rnd_pos -((std::f64::consts::PI/8.)*7.);
1021 let mut next_offset = -std::f64::consts::PI/4.;
1022 if (i == 0) {
1023 offset = rnd_pos -std::f64::consts::PI;
1024 next_offset = std::f64::consts::PI/4.;
1025 }
1026
1027 // we calculate angle, speed and offset for the 8 shots
1028 let mut offset_copy=offset;
1029 for y in 0..8 {
1030 pos[y * 3] = offset_copy.cos() * 32. + enemy.pos.x as f64;
1031 pos[y * 3 + 1] = offset_copy.sin() * 32. + enemy.pos.y as f64;
1032 pos[y * 3 + 2] = enemy.z as f64;
1033 offset_copy += std::f64::consts::PI/4.;
1034 }
1035
1036 // 3 rounds of 8 shots
1037 for z in 0..3 {
1038
1039 let mut length = 112.;
1040 // last subround
1041 if (z == 2) {length = 480.;}
1042
1043 for y in 0..8 {
1044 /*
1045 if (arg == 0) {
1046 let (mut si, mut ged, mut ed) = (8, 20.,ed=430.);
1047 if (LEVEL.rank < 2) {si=2; ged=28.; ed=length;}
1048 laser_args.angle = pos[y * 3];
1049 laser_args.speed = pos[y * 3 + 1];
1050 laser_args.start_offset = pos[y * 3 + 2];
1051 laser_args.type = 1;
1052 laser_args.sprite_index_offset = si;
1053 laser_args.end_offset = offset;
1054 laser_args.width = 0.;
1055 laser_args.duration = 0;
1056 laser_args.grazing_extra_duration = ged;
1057 laser_args.end_duration = ed;
1058 laser_args.UNK1 = z * 0x10 + 0x3c;
1059 laser_args.grazing_delay = laser_args.end_duration;
1060 fire_laser(&ETAMA_ARRAY,&laser_args);
1061 }
1062 else {
1063 (enemy->bullet_attributes).pos[0] = pos[y * 3];
1064 (enemy->bullet_attributes).pos[1] = pos[y*3+1];
1065 (enemy->bullet_attributes).pos[2] = pos[y*3+2];
1066 bullet_fire(&enemy->bullet_attributes,&ETAMA_ARRAY);
1067 }
1068 */
1069 pos[y * 3] = offset.cos() * length + pos[y * 3];
1070 pos[y * 3 + 1] = offset.sin() * length + pos[y * 3 + 1];
1071 offset = offset + std::f64::consts::PI/4.;
1072 }
1073 offset = (next_offset - 2.*std::f64::consts::PI) + offset;
1074 }
1075 }
1076 }
1010 8 => { // Vampire Fantasy 1077 8 => { // Vampire Fantasy
1011 /* 1078 /*
1012 let mut n = 0: 1079 let mut n = 0:
1013 for bullet in game.bullets{ 1080 for bullet in game.bullets{
1014 if bullet._bullet_type.state != 0 && bullet._bullet_type.state != 5 && (30. <= (bullet.sprites[0].additional_infos)->height) { 1081 if bullet._bullet_type.state != 0 && bullet._bullet_type.state != 5 && (30. <= (bullet.sprites[0].additional_infos)->height) {
1031 //TODO: this variable might not always be correct! it uses the argument in 1098 //TODO: this variable might not always be correct! it uses the argument in
1032 //th06: *(int *)(param_1 + 0x9b0) = local_60; 1099 //th06: *(int *)(param_1 + 0x9b0) = local_60;
1033 self._setval(-10004, n) 1100 self._setval(-10004, n)
1034 */ 1101 */
1035 } 1102 }
1103
1036 9 => { 1104 9 => {
1037 let mut rnd = self.get_prng().borrow_mut().get_f64(); 1105 let mut rnd = self.get_prng().borrow_mut().get_f64();
1038 //TODO: the game does that 1106 //TODO: the game does that
1039 //drop_particle(&PARTICLES_ARRAY,0xc,enemy->pos,1,0xffffffff); 1107 //drop_particle(&PARTICLES_ARRAY,0xc,enemy->pos,1,0xffffffff);
1040 //self._game.new_effect((enemy.x, enemy.y), 17) 1108 //self._game.new_effect((enemy.x, enemy.y), 17)