comparison src/th06/ecl_vm.rs @ 736:ff9651cfe1b0

ecl_vm: Remove trailing whitespace.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 28 Dec 2019 22:18:23 +0100
parents b9928db975e1
children 0977d479e37d
comparison
equal deleted inserted replaced
735:b9928db975e1 736:ff9651cfe1b0
632 632
633 let mut enemy = self.enemy.borrow_mut(); 633 let mut enemy = self.enemy.borrow_mut();
634 enemy.set_bullet_launch_interval(rand_start, interval); 634 enemy.set_bullet_launch_interval(rand_start, interval);
635 } 635 }
636 636
637 // 78-79 are more interpolation flags 637 // 78-79 are more interpolation flags
638 // 78 638 // 78
639 SubInstruction::DelayAttack() => { 639 SubInstruction::DelayAttack() => {
640 let mut enemy = self.enemy.borrow_mut(); 640 let mut enemy = self.enemy.borrow_mut();
641 enemy.delay_attack = true; 641 enemy.delay_attack = true;
642 } 642 }
700 let mut enemy = self.enemy.borrow_mut(); 700 let mut enemy = self.enemy.borrow_mut();
701 enemy.current_laser_id = laser_id; 701 enemy.current_laser_id = laser_id;
702 } 702 }
703 703
704 // 88 704 // 88
705 /* 705 /*
706 SubInstruction::AlterLaserAngle(laser_id, delta) => { 706 SubInstruction::AlterLaserAngle(laser_id, delta) => {
707 let mut enemy = self.enemy.borrow_mut(); 707 let mut enemy = self.enemy.borrow_mut();
708 if enemy.laser_by_id.contains_key(&laser_id) { 708 if enemy.laser_by_id.contains_key(&laser_id) {
709 let mut laser = enemy.laser_by_id.get(&laser_id); 709 let mut laser = enemy.laser_by_id.get(&laser_id);
710 laser.angle += self.get_f32(delta); 710 laser.angle += self.get_f32(delta);
711 } 711 }
712 } 712 }
713 */ 713 */
714 714
715 // 89 715 // 89
716 /* 716 /*
717 SubInstruction::AlterLaserAnglePlayer(laser_id, delta) => { 717 SubInstruction::AlterLaserAnglePlayer(laser_id, delta) => {
718 let mut enemy = self.enemy.borrow_mut(); 718 let mut enemy = self.enemy.borrow_mut();
719 if enemy.laser_by_id.contains_key(&laser_id) { 719 if enemy.laser_by_id.contains_key(&laser_id) {
741 // in game it checks if either the laser exists OR if one of its member is set to 0 741 // in game it checks if either the laser exists OR if one of its member is set to 0
742 // which, uhhhh, we are not going to reimplement for obvious reasons 742 // which, uhhhh, we are not going to reimplement for obvious reasons
743 // the correct implementation would be: if this laser does not exist have a 743 // the correct implementation would be: if this laser does not exist have a
744 // 1/100000 chance to continue, otherwise crash 744 // 1/100000 chance to continue, otherwise crash
745 if enemy.laser_by_id.contains_key(&laser_id) { 745 if enemy.laser_by_id.contains_key(&laser_id) {
746 // let's assume we gud 746 // let's assume we gud
747 self.frame.comparison_reg = 1; 747 self.frame.comparison_reg = 1;
748 } 748 }
749 else{ 749 else{
750 self.frame.comparison_reg = 0; 750 self.frame.comparison_reg = 0;
751 } 751 }
752 } 752 }
753 753
783 783
784 } 784 }
785 */ 785 */
786 786
787 787
788 // 96 788 // 96
789 /* 789 /*
790 SubInstruction::KillEnemies() => { 790 SubInstruction::KillEnemies() => {
791 let mut game = self.game.borrow_mut(); 791 let mut game = self.game.borrow_mut();
792 game.kill_enemies(); 792 game.kill_enemies();
793 } 793 }
794 */ 794 */
835 if value < 0 { 835 if value < 0 {
836 enemy.set_boss(false); 836 enemy.set_boss(false);
837 } 837 }
838 else { 838 else {
839 // the boss pointer is written somewhere in memory and overwrote by a 0 when 839 // the boss pointer is written somewhere in memory and overwrote by a 0 when
840 // the boss mode is false, might want to look into that 840 // the boss mode is false, might want to look into that
841 enemy.set_boss(true); 841 enemy.set_boss(true);
842 } 842 }
843 } 843 }
844 844
845 // 102 845 // 102
892 // 109 892 // 109
893 SubInstruction::MemoryWriteInt(value, index) => { 893 SubInstruction::MemoryWriteInt(value, index) => {
894 unimplemented!("not again that damn foe corrupted my ret\\x41\\x41\\x41\\x41"); 894 unimplemented!("not again that damn foe corrupted my ret\\x41\\x41\\x41\\x41");
895 } 895 }
896 896
897 // 110 897 // 110
898 /* 898 /*
899 SubInstruction::KillEnemy(enemy) => { 899 SubInstruction::KillEnemy(enemy) => {
900 let mut game = self.game.borrow_mut(); 900 let mut game = self.game.borrow_mut();
901 game.kill_enemy(enemy); 901 game.kill_enemy(enemy);
902 } 902 }
1130 //TODO: this variable might not always be correct! it uses the argument in 1130 //TODO: this variable might not always be correct! it uses the argument in
1131 //th06: *(int *)(param_1 + 0x9b0) = local_60; 1131 //th06: *(int *)(param_1 + 0x9b0) = local_60;
1132 self._setval(-10004, n) 1132 self._setval(-10004, n)
1133 */ 1133 */
1134 } 1134 }
1135 1135
1136 9 => { 1136 9 => {
1137 let mut rnd = self.get_prng().borrow_mut().get_f64(); 1137 let mut rnd = self.get_prng().borrow_mut().get_f64();
1138 //TODO: the game does that 1138 //TODO: the game does that
1139 //drop_particle(&PARTICLES_ARRAY,0xc,enemy->pos,1,0xffffffff); 1139 //drop_particle(&PARTICLES_ARRAY,0xc,enemy->pos,1,0xffffffff);
1140 //self._game.new_effect((enemy.x, enemy.y), 17) 1140 //self._game.new_effect((enemy.x, enemy.y), 17)
1145 //TODO: reverse this field and effect 1145 //TODO: reverse this field and effect
1146 bullet->field_0x5ba = 2; 1146 bullet->field_0x5ba = 2;
1147 new_effect(GAME_OBJECT,(sprite *)bullet, (int)bullet->sprites[0].sometimes_copy_of_UNK1 + (int)bullet->field_0x5ba); 1147 new_effect(GAME_OBJECT,(sprite *)bullet, (int)bullet->sprites[0].sometimes_copy_of_UNK1 + (int)bullet->field_0x5ba);
1148 bullet.speed=0.01; 1148 bullet.speed=0.01;
1149 bullet.frame=0x78; 1149 bullet.frame=0x78;
1150 1150
1151 let mut dx = bullet.x - enemy.x; 1151 let mut dx = bullet.x - enemy.x;
1152 let mut distance = dx.hypot(bullet.y - enemy.y); 1152 let mut distance = dx.hypot(bullet.y - enemy.y);
1153 1153
1154 if distance > 0.01 { 1154 if distance > 0.01 {
1155 distance = sqrt(distance); 1155 distance = sqrt(distance);
1156 }else{distance = 0.;} 1156 }else{distance = 0.;}
1157 let mut angle = (distance * std::f64::consts::PI) / 256. + (rnd * (2*std::f64::consts::PI) - std::f64::consts::PI); 1157 let mut angle = (distance * std::f64::consts::PI) / 256. + (rnd * (2*std::f64::consts::PI) - std::f64::consts::PI);
1158 bullet->attributes[0] = cos(angle) * 0.01000000; 1158 bullet->attributes[0] = cos(angle) * 0.01000000;