comparison src/th06/ecl_vm.rs @ 734:7886a1a5d226

ecl_vm: instruction 122 beginnings, sf 12 done
author Gauvain "GovanifY" Roussel-Tarbouriech <gauvain@govanify.com>
date Sun, 03 Nov 2019 04:42:58 +0100
parents 770e5057f6bc
children b9928db975e1
comparison
equal deleted inserted replaced
733:770e5057f6bc 734:7886a1a5d226
1233 let rand_y = game.prng.borrow_mut().get_f64(); 1233 let rand_y = game.prng.borrow_mut().get_f64();
1234 self.frame.floats[2] = (rand_x * fx + (192. - fx / 2.)) as f32; 1234 self.frame.floats[2] = (rand_x * fx + (192. - fx / 2.)) as f32;
1235 self.frame.floats[3] = (rand_y * fy + (96. - fy / 2.)) as f32; 1235 self.frame.floats[3] = (rand_y * fy + (96. - fy / 2.)) as f32;
1236 } 1236 }
1237 } 1237 }
1238 _ => unimplemented!("spellcards are a bitch and a half") 1238 _ => unimplemented!("Special function {:?} not found!", function)
1239 } 1239 }
1240 } 1240 }
1241 1241
1242 // 122
1243 // Here lies the Di Sword of despair
1244 SubInstruction::SetSpecialFunctionCallback(function) => {
1245 //TODO: those functions are executed at each frame and needs to be written to the
1246 //callback function but so far i'm simply focusing on the implementation
1247 //NB: the original engine doesn't differenciate between function blocks for ins 121
1248 //and 122 but we do here, since it wouldn't make sense the other way around.
1249 match function {
1250 12 => {
1251 for i in 0..8 {
1252 /*
1253 if ((enemy->lasers[i] != (laser *)0x0) && (enemy->lasers[i]->state != 0)) {
1254 (enemy->bullet_attributes).pos[0] = cos(enemy->lasers[i]->angle) * 64. + enemy.pos.x;
1255 // yes, it reads pos[0] after it has been modified and yes, this most
1256 // likely is a bug
1257 (enemy->bullet_attributes).pos[1] = cos(enemy->lasers[i]->angle) * (enemy->bullet_attributes).pos[0] + enemy.pos.y;
1258 (enemy->bullet_attributes).pos[2] = enemy.z;
1259 bullet_fire(&enemy->bullet_attributes,&ETAMA_ARRAY);
1260 }*/
1261 }
1262 }
1263 _ => unimplemented!("Special function {:?} not found!", function)
1264 }
1265 }
1242 _ => unimplemented!("{:?}", instruction) 1266 _ => unimplemented!("{:?}", instruction)
1243 } 1267 }
1268
1244 } 1269 }
1245 } 1270 }
1246 1271
1247 #[cfg(test)] 1272 #[cfg(test)]
1248 mod tests { 1273 mod tests {