# HG changeset patch # User Gauvain "GovanifY" Roussel-Tarbouriech # Date 1572752578 -3600 # Node ID 7886a1a5d226a0cb4866c920bb0132e28f97bf26 # Parent 770e5057f6bc2c5451b60c874f9ef62a2da0babc ecl_vm: instruction 122 beginnings, sf 12 done diff --git a/src/th06/ecl_vm.rs b/src/th06/ecl_vm.rs --- a/src/th06/ecl_vm.rs +++ b/src/th06/ecl_vm.rs @@ -1235,12 +1235,37 @@ impl EclRunner { self.frame.floats[3] = (rand_y * fy + (96. - fy / 2.)) as f32; } } - _ => unimplemented!("spellcards are a bitch and a half") + _ => unimplemented!("Special function {:?} not found!", function) } } + // 122 + // Here lies the Di Sword of despair + SubInstruction::SetSpecialFunctionCallback(function) => { + //TODO: those functions are executed at each frame and needs to be written to the + //callback function but so far i'm simply focusing on the implementation + //NB: the original engine doesn't differenciate between function blocks for ins 121 + //and 122 but we do here, since it wouldn't make sense the other way around. + match function { + 12 => { + for i in 0..8 { + /* + if ((enemy->lasers[i] != (laser *)0x0) && (enemy->lasers[i]->state != 0)) { + (enemy->bullet_attributes).pos[0] = cos(enemy->lasers[i]->angle) * 64. + enemy.pos.x; + // yes, it reads pos[0] after it has been modified and yes, this most + // likely is a bug + (enemy->bullet_attributes).pos[1] = cos(enemy->lasers[i]->angle) * (enemy->bullet_attributes).pos[0] + enemy.pos.y; + (enemy->bullet_attributes).pos[2] = enemy.z; + bullet_fire(&enemy->bullet_attributes,&ETAMA_ARRAY); + }*/ + } + } + _ => unimplemented!("Special function {:?} not found!", function) + } + } _ => unimplemented!("{:?}", instruction) } + } }