Mercurial > touhou
comparison src/th06/ecl_vm.rs @ 716:5016c09e5d7c
Fix some warnings.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 23 Sep 2019 13:49:07 +0200 |
parents | 464c1b02a996 |
children | c187e0a6b751 |
comparison
equal
deleted
inserted
replaced
715:2b2376811f46 | 716:5016c09e5d7c |
---|---|
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, BulletAttributes, Offset}; | 4 use crate::th06::enemy::{Enemy, Offset}; |
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 { |
731 } | 731 } |
732 */ | 732 */ |
733 // 91 | 733 // 91 |
734 // wat | 734 // wat |
735 SubInstruction::LaserSetCompare(laser_id) => { | 735 SubInstruction::LaserSetCompare(laser_id) => { |
736 let mut enemy = self.enemy.borrow_mut(); | 736 let enemy = self.enemy.borrow_mut(); |
737 // in game it checks if either the laser exists OR if one of its member is set to 0 | 737 // in game it checks if either the laser exists OR if one of its member is set to 0 |
738 // which, uhhhh, we are not going to reimplement for obvious reasons | 738 // which, uhhhh, we are not going to reimplement for obvious reasons |
739 // the correct implementation would be: if this laser does not exist have a | 739 // the correct implementation would be: if this laser does not exist have a |
740 // 1/100000 chance to continue, otherwise crash | 740 // 1/100000 chance to continue, otherwise crash |
741 if enemy.laser_by_id.contains_key(&laser_id) { | 741 if enemy.laser_by_id.contains_key(&laser_id) { |
827 let mut enemy = self.enemy.borrow_mut(); | 827 let mut enemy = self.enemy.borrow_mut(); |
828 enemy.death_anim = index; | 828 enemy.death_anim = index; |
829 } | 829 } |
830 // 101 | 830 // 101 |
831 SubInstruction::SetBossMode(value) => { | 831 SubInstruction::SetBossMode(value) => { |
832 let mut enemy = self.enemy.borrow_mut(); | 832 let enemy = self.enemy.borrow_mut(); |
833 if value < 0 { | 833 if value < 0 { |
834 enemy.set_boss(false); | 834 enemy.set_boss(false); |
835 } | 835 } |
836 else { | 836 else { |
837 // the boss pointer is written somewhere in memory and overwrote by a 0 when | 837 // the boss pointer is written somewhere in memory and overwrote by a 0 when |
870 enemy.damageable = (damageable&1) != 0; | 870 enemy.damageable = (damageable&1) != 0; |
871 } | 871 } |
872 | 872 |
873 // 106 | 873 // 106 |
874 SubInstruction::PlaySound(index) => { | 874 SubInstruction::PlaySound(index) => { |
875 let mut enemy = self.enemy.borrow_mut(); | 875 let enemy = self.enemy.borrow_mut(); |
876 enemy.play_sound(index); | 876 enemy.play_sound(index); |
877 } | 877 } |
878 | 878 |
879 // 107 | 879 // 107 |
880 SubInstruction::SetDeathFlags(death_flags) => { | 880 SubInstruction::SetDeathFlags(death_flags) => { |