comparison src/th06/ecl_vm.rs @ 682:d6cc9086058c

ecl_vm: more instructions
author Gauvain "GovanifY" Roussel-Tarbouriech <gauvain@govanify.com>
date Fri, 16 Aug 2019 21:31:00 +0200
parents 1209e7f855a4
children 8c50a7b19425
comparison
equal deleted inserted replaced
681:1209e7f855a4 682:d6cc9086058c
516 SubInstruction::SetRandomAngle(min_angle, max_angle) => { 516 SubInstruction::SetRandomAngle(min_angle, max_angle) => {
517 let angle = self.get_prng().borrow_mut().get_f64() as f32 * (max_angle - min_angle) + min_angle; 517 let angle = self.get_prng().borrow_mut().get_f64() as f32 * (max_angle - min_angle) + min_angle;
518 let mut enemy = self.enemy.borrow_mut(); 518 let mut enemy = self.enemy.borrow_mut();
519 enemy.angle = angle; 519 enemy.angle = angle;
520 } 520 }
521 521 // 51
522 /*
523 SubInstruction::TargetPlayer(angle, speed) => {
524 let mut enemy = self.enemy.borrow_mut();
525 let player = enemy.select_player();
526 enemy.update_mode = 0;
527 enemy.speed = speed;
528 enemy.angle = enemy.get_angle(player) + angle;
529
530 }
531 */
532 // 52 to 64 are different interlacing fields
533
534 // 65
535 // to note: in game a flag is set to enable the screenbox and is set by 66 to disable
536 // it on top of setting our values. But we have a good engine and can detect if that's
537 // changed without setting a flag :)
538 SubInstruction::SetScreenBox(xmin, ymin, xmax, ymax) => {
539 let mut enemy = self.enemy.borrow_mut();
540 enemy.screen_box = Some((xmin, ymin, xmax, ymax));
541 }
542 // 66
543 SubInstruction::ClearScreenBox() => {
544 let mut enemy = self.enemy.borrow_mut();
545 enemy.screen_box = None;
546 }
547 // 67 to 75 are set bullet attributes and it seems a pain to reverse rn
548
549
550
551 // 78-79 are more interpolation flags
522 // 78 552 // 78
523 SubInstruction::DelayAttack() => { 553 SubInstruction::DelayAttack() => {
524 let mut enemy = self.enemy.borrow_mut(); 554 let mut enemy = self.enemy.borrow_mut();
525 enemy.delay_attack = true; 555 enemy.delay_attack = true;
526 } 556 }
527 // 79 557 // 79
528 SubInstruction::NoDelayAttack() => { 558 SubInstruction::NoDelayAttack() => {
529 let mut enemy = self.enemy.borrow_mut(); 559 let mut enemy = self.enemy.borrow_mut();
530 enemy.delay_attack = false; 560 enemy.delay_attack = false;
531 } 561 }
532 562 // 80
533 // 83 -> star items >>> life items 563 /*
564 SubInstruction::NoClue() => {
565 let mut enemy = self.enemy.borrow_mut();
566 //bullet_pos = launch offset
567 (enemy->bullet_attributes).bullets_per_shot = enemy.pos.x + enemy->bullet_pos.pos.x;
568 (enemy->bullet_attributes).number_of_shots = enemy.pos.pos.y + enemy.bullet_pos.pos.y;
569 (enemy->bullet_attributes).speed = enemy.z + bullet_pos.z;
570 enemy.fire(bullet_attributes=bullet_attributes)
571 }
572 */
573 // 81
574 /*
575 SubInstruction::SetBulletLaunchOffset(x, y, z) => {
576 let mut enemy = self.enemy.borrow_mut();
577 enemy.bullet_launch_offset = (self._getval(x), self._getval(y), self._getval(z));
578 }
579 */
580 // 82
581 // TODO: correct but how to implement that in a rusty way?
582 /*
583 SubInstruction::SetExtendedBulletAttributes(x, y, z) => {
584 let mut enemy = self.enemy.borrow_mut();
585
586 // self._enemy.extended_bullet_attributes = tuple(self._getval(attr) for attr in attributes)
587 }
588 */
589 // 83
590 /*
591 SubInstruction::ChangeBulletsIntoStarBonus() => {
592 let mut game = self.game.borrow_mut();
593 game.change_bullets_into_star_items();
594 }
595 */
596
597
598
534 599
535 // 97 600 // 97
536 SubInstruction::SetAnim(index) => { 601 SubInstruction::SetAnim(index) => {
537 // seems correct, game internally gets base_addr =(iVar13 + 0x1c934), pointer_addr = iVar14 * 4 602 // seems correct, game internally gets base_addr =(iVar13 + 0x1c934), pointer_addr = iVar14 * 4
538 let mut enemy = self.enemy.borrow_mut(); 603 let mut enemy = self.enemy.borrow_mut();