comparison src/th06/ecl_vm.rs @ 663:994f41154be8

Implement EclRunner::set_i32 and EclRunner::set_f32.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 11 Aug 2019 18:19:19 +0200
parents 598f3125cbac
children f08e8e3c6196
comparison
equal deleted inserted replaced
662:107bb5ca5cc8 663:994f41154be8
130 _ => var 130 _ => var
131 } 131 }
132 } 132 }
133 133
134 fn set_i32(&mut self, var: i32, value: i32) { 134 fn set_i32(&mut self, var: i32, value: i32) {
135 unimplemented!() 135 let mut enemy = self.enemy.borrow_mut();
136 match var {
137 -10001 => self.variables.0[0] = value,
138 -10002 => self.variables.0[1] = value,
139 -10003 => self.variables.0[2] = value,
140 -10004 => self.variables.0[3] = value,
141 -10005 => unimplemented!(),
142 -10006 => unimplemented!(),
143 -10007 => unimplemented!(),
144 -10008 => unimplemented!(),
145 -10009 => self.variables.2[0] = value,
146 -10010 => self.variables.2[1] = value,
147 -10011 => self.variables.2[2] = value,
148 -10012 => self.variables.2[3] = value,
149 -10013 => unreachable!(),
150 -10014 => unreachable!(),
151 -10015 => unimplemented!(),
152 -10016 => unimplemented!(),
153 -10017 => unimplemented!(),
154 -10018 => unreachable!(),
155 -10019 => unreachable!(),
156 -10020 => unreachable!(),
157 -10021 => unreachable!(),
158 -10022 => enemy.frame = value as u32,
159 -10023 => unreachable!(),
160 -10024 => enemy.life = value as u32,
161 -10025 => unreachable!(),
162 _ => panic!("Unknown variable {}", var)
163 }
136 } 164 }
137 165
138 fn set_f32(&mut self, var: f32, value: f32) { 166 fn set_f32(&mut self, var: f32, value: f32) {
139 unimplemented!() 167 let mut enemy = self.enemy.borrow_mut();
168 match var {
169 -10001.0 => unimplemented!(),
170 -10002.0 => unimplemented!(),
171 -10003.0 => unimplemented!(),
172 -10004.0 => unimplemented!(),
173 -10005.0 => self.variables.1[0] = value,
174 -10006.0 => self.variables.1[1] = value,
175 -10007.0 => self.variables.1[2] = value,
176 -10008.0 => self.variables.1[3] = value,
177 -10009.0 => unimplemented!(),
178 -10010.0 => unimplemented!(),
179 -10011.0 => unimplemented!(),
180 -10012.0 => unimplemented!(),
181 -10013.0 => unreachable!(),
182 -10014.0 => unreachable!(),
183 -10015.0 => enemy.pos.x = value,
184 -10016.0 => enemy.pos.y = value,
185 -10017.0 => enemy.z = value,
186 -10018.0 => unreachable!(),
187 -10019.0 => unreachable!(),
188 -10020.0 => unreachable!(),
189 -10021.0 => unreachable!(),
190 -10022.0 => unimplemented!(),
191 -10023.0 => unreachable!(),
192 -10024.0 => unimplemented!(),
193 -10025.0 => unreachable!(),
194 _ => panic!("Unknown variable {}", var)
195 }
140 } 196 }
141 197
142 fn get_prng(&mut self) -> Rc<RefCell<Prng>> { 198 fn get_prng(&mut self) -> Rc<RefCell<Prng>> {
143 let enemy = self.enemy.borrow(); 199 let enemy = self.enemy.borrow();
144 enemy.prng.upgrade().unwrap() 200 enemy.prng.upgrade().unwrap()