comparison src/th06/ecl_vm.rs @ 683:8c50a7b19425

ecl_vm: more work
author Gauvain "GovanifY" Roussel-Tarbouriech <gauvain@govanify.com>
date Fri, 16 Aug 2019 23:45:28 +0200
parents d6cc9086058c
children c8bb28961d31
comparison
equal deleted inserted replaced
682:d6cc9086058c 683:8c50a7b19425
591 SubInstruction::ChangeBulletsIntoStarBonus() => { 591 SubInstruction::ChangeBulletsIntoStarBonus() => {
592 let mut game = self.game.borrow_mut(); 592 let mut game = self.game.borrow_mut();
593 game.change_bullets_into_star_items(); 593 game.change_bullets_into_star_items();
594 } 594 }
595 */ 595 */
596 // 84
597 // WARNING: dead code. If the parameter is < 0 it unsets a bullet_flag, otherwise it
598 // sets it, never using the parameter ever
599 /*
600 SubInstruction::UNK_ins84() => {
601 let mut enemy = self.enemy.borrow_mut();
602 enemy.bullet_flag_something
603 }
604 */
605
606 // 85-86 ire newlaser functions
607
608 // 87
609 SubInstruction::SetUpcomingLaserId(laser_id) => {
610 let mut enemy = self.enemy.borrow_mut();
611 enemy.current_laser_id = laser_id;
612 }
613
614 // 88
615
616 SubInstruction::AlterLaserAngle(laser_id, delta) => {
617 let mut enemy = self.enemy.borrow_mut();
618 if enemy.laser_by_id.contains_key(&laser_id) {
619 let mut laser = enemy.laser_by_id.get(laser_id);
620 laser.angle += self.get_f32(delta);
621 }
622 }
623
624 // 89
625 /*
626 SubInstruction::AlterLaserAnglePlayer(laser_id, delta) => {
627 let mut enemy = self.enemy.borrow_mut();
628 if enemy.laser_by_id.contains_key(&laser_id) {
629 let mut laser = enemy.laser_by_id.get(laser_id);
630 let player = enemy.select_player();
631 laser.angle = enemy.get_angle(player) + angle;
632 }
633 }
634 */
635
636 // 90
637 SubInstruction::RepositionLaser(laser_id, ox, oy, oz) => {
638 let mut enemy = self.enemy.borrow_mut();
639 if enemy.laser_by_id.contains_key(&laser_id) {
640 let mut laser = enemy.laser_by_id.get(laser_id);
641 laser.set_base_pos(enemy.pos.x + ox, enemy.pos.y + oy, enemy.z + oz)
642 }
643 }
644 // 91
645 // wat
646 SubInstruction::LaserSetCompare(laser_id) => {
647 let mut enemy = self.enemy.borrow_mut();
648 // in game it checks if either the laser exists OR if one of its member is set to 0
649 // which, uhhhh, we are not going to reimplement for obvious reasons
650 // the correct implementation would be: if this laser does not exist have a
651 // 1/100000 chance to continue, otherwise crash
652 if enemy.laser_by_id.contains_key(&laser_id) {
653 // let's assume we gud
654 self.comparison_reg = 1;
655 }
656 else{
657 self.comparison_reg = 0;
658 }
659 }
660
661 // 92
662 /*
663 SubInstruction::RepositionLaser(laser_id, ox, oy, oz) => {
664 let mut enemy = self.enemy.borrow_mut();
665 if enemy.laser_by_id.contains_key(&laser_id) {
666 let mut laser = enemy.laser_by_id.get(laser_id);
667 laser.cancel();
668 }
669 }
670 */
671
672
596 673
597 674
598 675
599 676
600 // 97 677 // 97
661 SubInstruction::SetDeathFlags(death_flags) => { 738 SubInstruction::SetDeathFlags(death_flags) => {
662 let mut enemy = self.enemy.borrow_mut(); 739 let mut enemy = self.enemy.borrow_mut();
663 enemy.death_flags = death_flags; 740 enemy.death_flags = death_flags;
664 } 741 }
665 742
743 // 109
744 SubInstruction::MemoryWriteInt(value, index) => {
745 unimplemented!("not again that damn foe corrupted my ret\\x41\\x41\\x41\\x41");
746 }
747
748
666 // 117 749 // 117
667 SubInstruction::SetTouchable(touchable) => { 750 SubInstruction::SetTouchable(touchable) => {
668 let mut enemy = self.enemy.borrow_mut(); 751 let mut enemy = self.enemy.borrow_mut();
669 enemy.touchable = touchable != 0; 752 enemy.touchable = touchable != 0;
753 }
754
755 // 121
756 // Here lies the Di Sword of sadness
757 SubInstruction::CallSpecialFunction(function, arg) => {
758 unimplemented!("spellcards are a bitch and a half");
670 } 759 }
671 760
672 _ => unimplemented!("{:?}", instruction) 761 _ => unimplemented!("{:?}", instruction)
673 } 762 }
674 } 763 }