changeset 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
files src/th06/ecl_vm.rs
diffstat 1 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)
         }
+
     }
 }