diff --git a/src/bullet.rs b/src/bullet.rs index 17ec230..2808e62 100644 --- a/src/bullet.rs +++ b/src/bullet.rs @@ -43,6 +43,10 @@ impl BulletManager { self.bullets.iter().filter(|b| b.owner == player_id && b.btype == btype).count() } + pub fn count_bullets_all(&self, btype: u16) -> usize { + self.bullets.iter().filter(|b| b.btype == btype).count() + } + pub fn count_bullets_multi(&self, btypes: [u16; 3], player_id: TargetPlayer) -> usize { self.bullets.iter().filter(|b| b.owner == player_id && btypes.contains(&b.btype)).count() } diff --git a/src/components/boss_life_bar.rs b/src/components/boss_life_bar.rs index e7f5e22..a26ed90 100644 --- a/src/components/boss_life_bar.rs +++ b/src/components/boss_life_bar.rs @@ -99,8 +99,8 @@ impl GameEntity<&NPCMap> for BossLifeBar { let mut rect_prev_bar = Rect::new_size(0, 32, 232, 8); let mut rect_life_bar = Rect::new_size(0, 24, 232, 8); - rect_prev_bar.right = ((self.prev_life as u16 * bar_length) / self.max_life as u16).min(bar_length); - rect_life_bar.right = ((self.life as u16 * bar_length) / self.max_life as u16).min(bar_length); + rect_prev_bar.right = ((self.prev_life as u32 * bar_length) / self.max_life as u32).min(bar_length) as u16; + rect_life_bar.right = ((self.life as u32 * bar_length) / self.max_life as u32).min(bar_length) as u16; batch.add_rect(((state.canvas_size.0 - box_length as f32) / 2.0).floor(), state.canvas_size.1 - 20.0, &box_rect1); diff --git a/src/engine_constants/npcs.rs b/src/engine_constants/npcs.rs index f5b0681..3749180 100644 --- a/src/engine_constants/npcs.rs +++ b/src/engine_constants/npcs.rs @@ -1065,6 +1065,9 @@ pub struct NPCConsts { #[serde(default = "default_n361_gaudi_dashing")] pub n361_gaudi_dashing: [Rect; 4], + #[serde(default = "default_b01_omega")] + pub b01_omega: [Rect; 10], + #[serde(default = "default_b02_balfrog")] pub b02_balfrog: [Rect; 18], @@ -4748,6 +4751,21 @@ fn default_n361_gaudi_dashing() -> [Rect; 4] { ] } +fn default_b01_omega() -> [Rect; 10] { + [ + Rect { left: 0, top: 0, right: 80, bottom: 56 }, + Rect { left: 80, top: 0, right: 160, bottom: 56 }, + Rect { left: 160, top: 0, right: 240, bottom: 56 }, + Rect { left: 80, top: 0, right: 160, bottom: 56 }, + Rect { left: 80, top: 56, right: 104, bottom: 72 }, + Rect { left: 104, top: 56, right: 128, bottom: 72 }, + Rect { left: 0, top: 56, right: 40, bottom: 88 }, + Rect { left: 40, top: 56, right: 80, bottom: 88 }, + Rect { left: 0, top: 88, right: 40, bottom: 120 }, + Rect { left: 40, top: 88, right: 80, bottom: 120 }, + ] +} + fn default_b02_balfrog() -> [Rect; 18] { [ Rect { left: 0, top: 0, right: 0, bottom: 0 }, diff --git a/src/npc/boss/balfrog.rs b/src/npc/boss/balfrog.rs index cfcc605..b35ab39 100644 --- a/src/npc/boss/balfrog.rs +++ b/src/npc/boss/balfrog.rs @@ -33,7 +33,7 @@ impl NPC { } impl BossNPC { - pub(crate) fn tick_b02_balfrog(&mut self, state: &mut SharedGameState, player: &Player) { + pub(crate) fn tick_b02_balfrog(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) { match self.parts[0].action_num { 0 => { self.hurt_sound[0] = 52; @@ -152,6 +152,7 @@ impl BossNPC { self.parts[0].display_bounds.top = 48 * 0x200; self.parts[0].display_bounds.bottom = 16 * 0x200; + let player = self.parts[0].get_closest_player_mut(players); if self.parts[0].direction == Direction::Left && self.parts[0].x < player.x { self.parts[0].direction = Direction::Right; self.parts[0].action_num = 110; @@ -235,6 +236,7 @@ impl BossNPC { self.parts[0].action_counter = 0; self.parts[0].vel_x2 = self.parts[0].vel_x2.saturating_sub(1); + let player = self.parts[0].get_closest_player_mut(players); let px = self.parts[0].x + self.parts[0].direction.vector_x() * 2 * 16 * 0x200 - player.x; let py = self.parts[0].y - 8 * 0x200 - player.y; @@ -351,6 +353,7 @@ impl BossNPC { state.new_npcs.push(npc); } + let player = self.parts[0].get_closest_player_mut(players); if self.parts[0].direction == Direction::Left && self.parts[0].x < player.x { self.parts[0].action_num = 110; self.parts[0].direction = Direction::Right; diff --git a/src/npc/boss/mod.rs b/src/npc/boss/mod.rs index afa1272..1f8891c 100644 --- a/src/npc/boss/mod.rs +++ b/src/npc/boss/mod.rs @@ -3,6 +3,7 @@ use std::collections::BTreeMap; use ggez::{Context, GameResult}; +use crate::bullet::BulletManager; use crate::common::{Direction, interpolate_fix9_scale}; use crate::entity::GameEntity; use crate::frame::Frame; @@ -36,6 +37,13 @@ impl BossNPC { part }; 16]; parts[0].cond.set_alive(true); + for (i, part) in parts.iter_mut().enumerate() { + part.rng.load_state((i + .wrapping_add(398564) + .wrapping_mul(0x4985327) + .rotate_right(7) + .wrapping_sub(0x851356489) & 0xffffffff) as u32); + } BossNPC { boss_type: 0, @@ -46,15 +54,15 @@ impl BossNPC { } } -impl GameEntity<(&mut Player, &BTreeMap>, &mut Stage)> for BossNPC { - fn tick(&mut self, state: &mut SharedGameState, (player, map, stage): (&mut Player, &BTreeMap>, &mut Stage)) -> GameResult { +impl GameEntity<([&mut Player; 2], &BTreeMap>, &mut Stage, &BulletManager)> for BossNPC { + fn tick(&mut self, state: &mut SharedGameState, (players, map, stage, bullet_manager): ([&mut Player; 2], &BTreeMap>, &mut Stage, &BulletManager)) -> GameResult { if !self.parts[0].cond.alive() { return Ok(()); } match self.boss_type { - 1 => self.tick_b01_omega(), - 2 => self.tick_b02_balfrog(state, player), + 1 => self.tick_b01_omega(state, players, map, bullet_manager), + 2 => self.tick_b02_balfrog(state, players), 3 => self.tick_b03_monster_x(), 4 => self.tick_b04_core(), 5 => self.tick_b05_ironhead(), diff --git a/src/npc/boss/omega.rs b/src/npc/boss/omega.rs index 3b8ebf7..c41180d 100644 --- a/src/npc/boss/omega.rs +++ b/src/npc/boss/omega.rs @@ -1,7 +1,469 @@ +use std::cell::RefCell; +use std::collections::BTreeMap; + +use ggez::GameResult; + +use crate::bullet::BulletManager; +use crate::caret::CaretType; +use crate::common::{Direction, Rect}; +use crate::npc::{NPC, NPCMap}; use crate::npc::boss::BossNPC; +use crate::player::Player; +use crate::shared_game_state::SharedGameState; -impl BossNPC { - pub(crate) fn tick_b01_omega(&mut self) { +impl NPC { + pub(crate) fn tick_n048_omega_projectiles(&mut self, state: &mut SharedGameState) -> GameResult { + if self.flags.hit_left_wall() && self.vel_x < 0 { + self.vel_x = -self.vel_x; + } else if self.flags.hit_right_wall() && self.vel_x > 0 { + self.vel_x = -self.vel_x; + } else if self.flags.hit_bottom_wall() { + self.action_counter2 += 1; + if self.action_counter2 <= 2 && self.direction != Direction::Right { + self.vel_y = -0x100; + } else { + self.cond.set_drs_destroyed(true); + state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left); + } + } + if self.direction == Direction::Right { + self.npc_flags.set_shootable(false); + self.npc_flags.set_invulnerable(true); + } + + self.vel_y += 0x5; + self.x += self.vel_x; + self.y += self.vel_y; + + self.action_counter += 1; + if self.action_counter > 750 { + state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left); + self.cond.set_alive(false); + } + + self.animate(2, 0, 1); + + let dir_offset = if self.direction == Direction::Left { 0 } else { 2 }; + + self.anim_rect = state.constants.npc.n048_omega_projectiles[self.anim_num as usize + dir_offset]; + + Ok(()) + } +} + +impl BossNPC { + pub(crate) fn tick_b01_omega(&mut self, state: &mut SharedGameState, players: [&mut Player; 2], npc_map: &BTreeMap>, bullet_manager: &BulletManager) { + match self.parts[0].action_num { + 0 => { + self.parts[0].cond.set_alive(true); + self.parts[0].size = 3; + self.parts[0].exp = 1; + self.parts[0].event_num = 210; + self.parts[0].life = 400; + self.parts[0].npc_flags.set_show_damage(true); + self.parts[0].npc_flags.set_event_when_killed(true); + self.parts[0].npc_flags.set_ignore_solidity(true); + self.parts[0].x = 219 * 16 * 0x200; + self.parts[0].y = 16 * 16 * 0x200; + self.parts[0].target_x = self.parts[0].x; + self.parts[0].target_y = self.parts[0].y; + self.parts[0].display_bounds = Rect { + left: 40 * 0x200, + top: 40 * 0x200, + right: 40 * 0x200, + bottom: 16 * 0x200, + }; + self.parts[0].hit_bounds = Rect { + left: 8 * 0x200, + top: 24 * 0x200, + right: 8 * 0x200, + bottom: 16 * 0x200, + }; + + self.parts[1].cond.set_alive(true); + self.parts[1].display_bounds = Rect { + left: 12 * 0x200, + top: 8 * 0x200, + right: 12 * 0x200, + bottom: 8 * 0x200, + }; + self.parts[1].npc_flags.set_ignore_solidity(true); + self.parts[1].direction = Direction::Left; + + self.parts[2].cond.set_alive(true); + self.parts[2].display_bounds = self.parts[1].display_bounds; + self.parts[2].npc_flags = self.parts[1].npc_flags; + self.parts[2].direction = Direction::Right; + + self.parts[3].cond.set_alive(true); + self.parts[3].npc_flags.set_ignore_solidity(true); + self.parts[3].direction = Direction::Left; + self.parts[3].x = self.parts[0].x + 16 * 0x200; + self.parts[3].y = self.parts[0].y; + self.parts[3].display_bounds = Rect { + left: 24 * 0x200, + top: 16 * 0x200, + right: 16 * 0x200, + bottom: 16 * 0x200, + }; + self.parts[3].hit_bounds = Rect { + left: 8 * 0x200, + top: 8 * 0x200, + right: 8 * 0x200, + bottom: 8 * 0x200, + }; + self.hurt_sound[3] = 52; + + + self.parts[4].cond.set_alive(true); + self.parts[4].display_bounds = self.parts[3].display_bounds; + self.parts[4].hit_bounds = self.parts[3].hit_bounds; + self.parts[4].npc_flags = self.parts[3].npc_flags; + self.parts[4].y = self.parts[3].y; + self.parts[4].direction = Direction::Right; + self.hurt_sound[4] = 52; + + self.parts[5].cond.set_alive(true); + } + 20 | 30 => { + if self.parts[0].action_num == 20 { + self.parts[0].action_num = 30; + self.parts[0].action_counter = 0; + self.parts[0].anim_num = 0; + } + + self.parts[0].y -= 0x200; + self.parts[0].action_counter += 1; + state.quake_counter = 2; + + if self.parts[0].action_counter % 4 == 0 { + state.sound_manager.play_sfx(26); + } + + if self.parts[0].action_counter == 48 { + self.parts[0].action_counter = 0; + self.parts[0].action_num = 40; + + if self.parts[0].life <= 280 { + self.parts[0].action_num = 110; + self.parts[0].npc_flags.set_shootable(true); + self.parts[0].npc_flags.set_ignore_solidity(false); + self.parts[3].npc_flags.set_ignore_solidity(false); + self.parts[4].npc_flags.set_ignore_solidity(false); + self.parts[3].action_num = 3; + self.parts[4].action_num = 3; + self.parts[5].hit_bounds.top = 16 * 0x200; + } + } + } + 40 => { + self.parts[0].action_counter += 1; + if self.parts[0].action_counter == 48 { + self.parts[0].action_counter = 0; + self.parts[0].action_num = 50; + self.parts[0].anim_counter = 0; + self.parts[5].hit_bounds.top = 16 * 0x200; + + state.sound_manager.play_sfx(102); + } + } + 50 => { + self.parts[0].anim_counter += 1; + if self.parts[0].anim_counter > 2 { + self.parts[0].anim_counter = 0; + self.parts[0].anim_num += 1; + + if self.parts[0].anim_num == 3 { + self.parts[0].action_num = 60; + self.parts[0].action_counter = 0; + self.parts[0].npc_flags.set_shootable(true); + self.parts[0].hit_bounds.left = 16 * 0x200; + self.parts[0].hit_bounds.right = 16 * 0x200; + } + } + } + 60 => { + self.parts[0].action_counter += 1; + if self.parts[0].action_counter % 3 == 0 && (20..80).contains(&self.parts[0].action_counter) { + let mut npc = NPCMap::create_npc(48, &state.npc_table); + npc.cond.set_alive(true); + npc.x = self.parts[0].x; + npc.y = self.parts[0].y - 16 * 0x200; + npc.vel_x = self.parts[0].rng.range(-0x100..0x100) as isize; + npc.vel_y = -0x333; + npc.direction = if self.parts[0].rng.range(0..9) <= 7 { + Direction::Left + } else { + Direction::Right + }; + + state.new_npcs.push(npc); + state.sound_manager.play_sfx(39); + } + + if self.parts[0].action_counter == 200 || bullet_manager.count_bullets_all(6) > 0 { + self.parts[0].action_num = 70; + self.parts[0].anim_counter = 0; + + state.sound_manager.play_sfx(102); + } + } + 70 => { + self.parts[0].anim_counter += 1; + if self.parts[0].anim_counter > 2 { + self.parts[0].anim_counter = 0; + self.parts[0].anim_num -= 1; + + match self.parts[0].anim_num { + 1 => self.parts[0].damage = 20, + 0 => { + self.parts[0].action_num = 80; + self.parts[0].action_counter = 0; + self.parts[0].npc_flags.set_shootable(false); + self.parts[0].hit_bounds.left = 24 * 0x200; + self.parts[0].hit_bounds.right = 24 * 0x200; + self.parts[0].damage = 0; + self.parts[5].hit_bounds.top = 36 * 0x200; + } + _ => {} + } + } + } + 80 => { + self.parts[0].action_counter += 1; + if self.parts[0].action_counter == 48 { + self.parts[0].action_counter = 0; + self.parts[0].action_num = 90; + } + } + 90 => { + state.quake_counter = 2; + self.parts[0].y += 0x200; + self.parts[0].action_counter += 1; + + if self.parts[0].action_counter % 4 == 0 { + state.sound_manager.play_sfx(26); + } + + if self.parts[0].action_counter == 48 { + self.parts[0].action_num = 100; + self.parts[0].action_counter = 0; + } + } + 100 => { + self.parts[0].action_counter += 1; + if self.parts[0].action_counter == 120 { + self.parts[0].action_num = 30; + self.parts[0].action_counter = 0; + self.parts[0].x = self.parts[0].target_x + self.parts[0].rng.range(-0x40..0x40) as isize * 0x200; + self.parts[0].y = self.parts[0].target_y; + } + } + 110 => { + self.parts[0].anim_counter += 1; + if self.parts[0].anim_counter > 2 { + self.parts[0].anim_counter = 0; + self.parts[0].anim_num += 1; + if self.parts[0].anim_num == 3 { + self.parts[0].action_num = 120; + self.parts[0].action_counter = 0; + self.parts[0].hit_bounds.left = 16 * 0x200; + self.parts[0].hit_bounds.right = 16 * 0x200; + } + } + } + 120 => { + self.parts[0].action_counter += 1; + if self.parts[0].action_counter == 50 || bullet_manager.count_bullets_all(6) > 0 { + self.parts[0].action_num = 130; + self.parts[0].action_counter = 0; + self.parts[0].anim_counter = 0; + + state.sound_manager.play_sfx(102); + } + + if self.parts[0].action_counter <= 29 && self.parts[0].action_counter % 5 == 0 { + let mut npc = NPCMap::create_npc(48, &state.npc_table); + npc.cond.set_alive(true); + npc.x = self.parts[0].x; + npc.y = self.parts[0].y - 16 * 0x200; + npc.vel_x = self.parts[0].rng.range(-0x155..0x155) as isize; + npc.vel_y = -0x333; + npc.direction = Direction::Left; + + state.new_npcs.push(npc); + state.sound_manager.play_sfx(39); + } + } + 130 => { + self.parts[0].anim_counter += 1; + if self.parts[0].anim_counter > 2 { + self.parts[0].anim_counter = 0; + self.parts[0].anim_num -= 1; + + match self.parts[0].anim_num { + 1 => self.parts[0].damage = 20, + 0 => { + self.parts[0].action_num = 140; + self.parts[0].npc_flags.set_shootable(true); + self.parts[0].hit_bounds.left = 16 * 0x200; + self.parts[0].hit_bounds.right = 16 * 0x200; + let player = self.parts[0].get_closest_player_mut(players); + self.parts[0].vel_x = (player.x - self.parts[0].x).signum() * 0x100; + self.parts[0].damage = 0; + self.parts[0].hit_bounds.top = 36 * 0x200; + } + _ => {} + } + } + } + 140 => { + let player = self.parts[5].get_closest_player_mut(players); + self.parts[5].damage = if player.flags.hit_bottom_wall() && self.parts[0].vel_y > 0 { + 20 + } else { + 0 + }; + self.parts[0].vel_y += 0x24; + if self.parts[0].vel_y > 0x5ff { + self.parts[0].vel_y = 0x5ff; + } + + self.parts[0].y += self.parts[0].vel_y; + self.parts[0].x += self.parts[0].vel_x; + + if self.parts[0].flags.hit_bottom_wall() { + self.parts[0].action_num = 110; + self.parts[0].action_counter = 0; + self.parts[0].anim_counter = 0; + self.parts[5].hit_bounds.top = 16 * 0x200; + self.parts[5].damage = 0; + + state.sound_manager.play_sfx(26); + state.sound_manager.play_sfx(12); + state.quake_counter = 30; + } + } + 150 => { + state.quake_counter = 2; + + self.parts[0].action_counter += 1; + if self.parts[0].action_counter % 12 == 0 { + state.sound_manager.play_sfx(52); + } + + let dest_x = self.parts[0].x + self.parts[0].rng.range(-0x30..0x30) as isize * 0x200; + let dest_y = self.parts[0].y + self.parts[0].rng.range(-0x30..0x18) as isize * 0x200; + + let mut npc = NPCMap::create_npc(4, &state.npc_table); + npc.cond.set_alive(true); + npc.x = dest_x; + npc.y = dest_y; + state.new_npcs.push(npc); + state.create_caret(dest_x, dest_y, CaretType::Explosion, Direction::Left); + + if self.parts[0].action_counter > 100 { + self.parts[0].action_num = 160; + self.parts[0].action_counter = 0; + // todo flash + state.sound_manager.play_sfx(35); + } + } + 160 => { + state.quake_counter = 40; + + self.parts[0].action_counter += 1; + if self.parts[0].action_counter > 50 { + for i in 0..6 { + self.parts[i].cond.set_alive(false); + } + } + } + _ => {} + } + + self.parts[0].anim_rect = state.constants.npc.b01_omega[self.parts[0].anim_num as usize]; + for i in 1..5 { + self.parts[i].shock = self.parts[0].shock; + } + + for &i in [3, 4].iter() { + match self.parts[i].action_num { + 0 | 1 => { + if self.parts[i].action_num == 0 { + self.parts[i].action_num = 1; + } + + self.parts[i].y = self.parts[0].y; + + match i { + 3 => self.parts[i].x = self.parts[0].x - 16 * 0x200, + 4 => self.parts[i].x = self.parts[0].x + 16 * 0x200, + _ => {} + } + } + 3 => { + self.parts[i].target_y = self.parts[0].y + 24 * 0x200; + + match i { + 3 => self.parts[i].x = self.parts[0].x - 16 * 0x200, + 4 => self.parts[i].x = self.parts[0].x + 16 * 0x200, + _ => {} + } + + self.parts[i].y += (self.parts[0].target_y - self.parts[0].y) / 2; + } + _ => {} + } + + if self.parts[i].flags.hit_bottom_wall() || self.parts[i].y <= self.parts[i].target_y { + self.parts[i].anim_num = 0; + } else { + self.parts[i].anim_num = 1; + } + + let dir_offset = if self.parts[i].direction == Direction::Left { 0 } else { 2 }; + + self.parts[i].anim_rect = state.constants.npc.b01_omega[6 + dir_offset + self.parts[i].anim_num as usize]; + } + + for &i in [1, 2].iter() { + self.parts[i].x = self.parts[0].x + self.parts[i].direction.vector_x() * 16 * 0x200; + self.parts[i].y = (self.parts[0].y + self.parts[i + 2].y - 8 * 0x200) / 2; + + let dir_offset = if self.parts[i].direction == Direction::Left { 0 } else { 1 }; + + self.parts[i].anim_rect = state.constants.npc.b01_omega[4 + dir_offset]; + } + + if self.parts[5].action_num == 0 { + self.parts[5].action_num = 1; + self.parts[5].npc_flags.set_solid_soft(true); + self.parts[5].npc_flags.set_ignore_solidity(true); + self.parts[5].hit_bounds = Rect { + left: 20 * 0x200, + top: 36 * 0x200, + right: 20 * 0x200, + bottom: 16 * 0x200, + }; + } + + self.parts[5].x = self.parts[0].x; + self.parts[5].y = self.parts[0].y; + + if self.parts[0].life == 0 && self.parts[0].action_num < 150 { + self.parts[0].action_num = 150; + self.parts[0].action_counter = 0; + self.parts[0].damage = 0; + self.parts[5].damage = 5; + + for npc_cell in npc_map.values() { + let mut npc = npc_cell.borrow_mut(); + if npc.cond.alive() && npc.npc_type == 48 { + npc.cond.set_alive(false); + } + } + } } } diff --git a/src/npc/mod.rs b/src/npc/mod.rs index af958d5..d088ecf 100644 --- a/src/npc/mod.rs +++ b/src/npc/mod.rs @@ -23,6 +23,7 @@ use crate::rng::Xoroshiro32PlusPlus; use crate::shared_game_state::SharedGameState; use crate::stage::Stage; use crate::str; +use crate::bullet::BulletManager; pub mod balrog; pub mod booster; @@ -116,7 +117,7 @@ pub struct NPC { pub rng: Xoroshiro32PlusPlus, } -static PARTICLE_NPCS: [u16; 12] = [1, 4, 11, 45, 73, 84, 86, 87, 108, 129, 199, 355]; +static PARTICLE_NPCS: [u16; 13] = [1, 4, 11, 45, 48, 73, 84, 86, 87, 108, 129, 199, 355]; impl NPC { pub fn get_start_index(&self) -> u16 { @@ -167,8 +168,8 @@ impl NPC { } } -impl GameEntity<([&mut Player; 2], &BTreeMap>, &mut Stage)> for NPC { - fn tick(&mut self, state: &mut SharedGameState, (players, map, stage): ([&mut Player; 2], &BTreeMap>, &mut Stage)) -> GameResult { +impl GameEntity<([&mut Player; 2], &BTreeMap>, &mut Stage, &BulletManager)> for NPC { + fn tick(&mut self, state: &mut SharedGameState, (players, map, stage, bullet_manager): ([&mut Player; 2], &BTreeMap>, &mut Stage, &BulletManager)) -> GameResult { match self.npc_type { 0 => self.tick_n000_null(), 1 => self.tick_n001_experience(state), @@ -218,6 +219,7 @@ impl GameEntity<([&mut Player; 2], &BTreeMap>, &mut Stage)> fo 45 => self.tick_n045_baby(state), 46 => self.tick_n046_hv_trigger(players), 47 => self.tick_n047_sandcroc(state, players), + 48 => self.tick_n048_omega_projectiles(state), 52 => self.tick_n052_sitting_blue_robot(state), 55 => self.tick_n055_kazuma(state), 58 => self.tick_n058_basu(state, players), diff --git a/src/scene/game_scene.rs b/src/scene/game_scene.rs index 2d38371..719acd0 100644 --- a/src/scene/game_scene.rs +++ b/src/scene/game_scene.rs @@ -1031,11 +1031,11 @@ impl GameScene { let mut npc = npc_cell.borrow_mut(); if npc.cond.alive() { - npc.tick(state, ([&mut self.player1, &mut self.player2], &self.npc_map.npcs, &mut self.stage))?; + npc.tick(state, ([&mut self.player1, &mut self.player2], &self.npc_map.npcs, &mut self.stage, &self.bullet_manager))?; } } } - self.npc_map.boss_map.tick(state, (&mut self.player1, &self.npc_map.npcs, &mut self.stage))?; + self.npc_map.boss_map.tick(state, ([&mut self.player1, &mut self.player2], &self.npc_map.npcs, &mut self.stage, &self.bullet_manager))?; self.npc_map.process_npc_changes(&self.player1, state); self.npc_map.garbage_collect(); diff --git a/src/text_script.rs b/src/text_script.rs index 347290d..4893463 100644 --- a/src/text_script.rs +++ b/src/text_script.rs @@ -782,19 +782,19 @@ impl TextScriptVM { Direction::Left => { game_scene.player1.vel_x = 0x200; game_scene.player2.vel_x = 0x200; - }, + } Direction::Up => { game_scene.player1.vel_y = -0x200; game_scene.player2.vel_y = -0x200; - }, + } Direction::Right => { game_scene.player1.vel_x = -0x200; game_scene.player2.vel_x = -0x200; - }, + } Direction::Bottom => { game_scene.player1.vel_y = 0x200; game_scene.player2.vel_y = 0x200; - }, + } Direction::FacingPlayer => { // todo npc direction dependent bump } @@ -1534,7 +1534,7 @@ impl TextScriptVM { if tick_npc != 0 { if let Some(npc) = game_scene.npc_map.npcs.get(&tick_npc) { - npc.borrow_mut().tick(state, ([&mut game_scene.player1, &mut game_scene.player2], &game_scene.npc_map.npcs, &mut game_scene.stage))?; + npc.borrow_mut().tick(state, ([&mut game_scene.player1, &mut game_scene.player2], &game_scene.npc_map.npcs, &mut game_scene.stage, &game_scene.bullet_manager))?; } }