diff src/th06/ecl_vm.rs @ 728:414f8611f344

ecl: Add support for bullet sounds, instruction 84.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 30 Oct 2019 16:27:43 +0100
parents fbf89cba04e2
children ca46b4312df1
line wrap: on
line diff
--- a/src/th06/ecl_vm.rs
+++ b/src/th06/ecl_vm.rs
@@ -679,15 +679,19 @@ impl EclRunner {
                 game.change_bullets_into_star_items();
             }
             */
+
             // 84
-            // WARNING: dead code. If the parameter is < 0 it unsets a bullet_flag, otherwise it
-            // sets it, never using the parameter ever
-            /*
-            SubInstruction::UNK_ins84() => {
+            SubInstruction::SetBulletSound(sound) => {
                 let mut enemy = self.enemy.borrow_mut();
-                enemy.bullet_flag_something
+                if sound < 0 {
+                    enemy.bullet_attributes.sound = None;
+                } else {
+                    // This assert isn’t part of the original engine, but it would crash on high
+                    // values anyway.
+                    assert!(sound <= 255);
+                    enemy.bullet_attributes.sound = Some(sound as u8);
+                }
             }
-            */
 
             // 85-86 ire newlaser functions