mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-03-24 10:59:20 +00:00
Refactor: Unify NPC AI handler signature
This commit is contained in:
parent
6660d5356b
commit
8d416c83be
|
@ -1,13 +1,15 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n254_helicopter(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n254_helicopter(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -84,7 +86,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n255_helicopter_blades(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -136,8 +138,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n260_shovel_brigade_caged(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -190,7 +191,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n261_chie_caged(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -231,7 +232,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n262_chaco_caged(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
use num_traits::clamp;
|
||||
|
||||
use crate::common::{CDEG_RAD, Direction};
|
||||
use crate::common::{Direction, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n009_balrog_falling_in(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -81,8 +78,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n010_balrog_shooting(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -182,7 +178,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n011_balrogs_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n011_balrogs_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.flags.hit_anything() {
|
||||
self.cond.set_alive(false);
|
||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
||||
|
@ -207,9 +203,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n012_balrog_cutscene(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { players, npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -542,7 +536,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n019_balrog_bust_in(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n019_balrog_bust_in(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -619,7 +617,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n033_balrog_bouncing_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n033_balrog_bouncing_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.flags.hit_left_wall() || self.flags.hit_right_wall() {
|
||||
self.cond.set_alive(false);
|
||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
||||
|
@ -656,8 +654,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n036_balrog_hover(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -819,8 +816,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n068_balrog_running(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
mut players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { mut players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1000,8 +996,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n169_balrog_shooting_missiles(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
mut players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { mut players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1217,8 +1212,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n170_balrog_missile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if (self.direction == Direction::Left && self.flags.hit_left_wall())
|
||||
|| (self.direction == Direction::Right && self.flags.hit_right_wall())
|
||||
|
@ -1279,7 +1273,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n306_balrog_nurse(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n306_balrog_nurse(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -1315,8 +1309,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n356_balrog_rescuing(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 11 => {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n113_professor_booster(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n113_professor_booster(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n093_chaco(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n093_chaco(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -23,9 +26,7 @@ impl NPC {
|
|||
}
|
||||
|
||||
let player = self.get_closest_player_mut(players);
|
||||
if (self.x - player.x).abs() < 0x4000
|
||||
&& self.y - 0x4000 < player.y
|
||||
&& self.y + 0x2000 > player.y {
|
||||
if (self.x - player.x).abs() < 0x4000 && self.y - 0x4000 < player.y && self.y + 0x2000 > player.y {
|
||||
self.direction = if self.x > player.x { Direction::Left } else { Direction::Right };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,16 @@ use num_traits::{abs, clamp};
|
|||
|
||||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n029_cthulhu(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n029_cthulhu(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_num = 0;
|
||||
|
@ -31,7 +33,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n052_sitting_blue_robot(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n052_sitting_blue_robot(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n052_sitting_blue_robot;
|
||||
|
@ -40,7 +42,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n055_kazuma(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n055_kazuma(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -74,7 +76,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n061_king(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n061_king(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -246,7 +252,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n062_kazuma_computer(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n062_kazuma_computer(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -307,7 +313,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n074_jack(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n074_jack(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -359,7 +365,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n145_king_sword(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n145_king_sword(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
let parent = self.get_parent_ref_mut(npc_list);
|
||||
if let Some(parent) = parent {
|
||||
|
@ -387,7 +397,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n151_blue_robot_standing(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n151_blue_robot_standing(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -419,7 +429,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n167_booster_falling(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n167_booster_falling(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -470,7 +484,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n217_itoh(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n217_itoh(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -560,7 +574,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n278_little_family(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n278_little_family(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -633,7 +647,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n305_small_puppy(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n305_small_puppy(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y -= 0x2000;
|
||||
|
@ -651,11 +665,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n326_sue_itoh_human_transition(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
) -> GameResult {
|
||||
pub(crate) fn tick_n326_sue_itoh_human_transition(&mut self, state: &mut SharedGameState, NPCContext { npc_list, .. }: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -763,7 +773,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n327_sneeze(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n327_sneeze(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
self.action_counter += 1;
|
||||
|
||||
if self.action_num == 0 {
|
||||
|
|
|
@ -3,19 +3,16 @@ use num_traits::{abs, clamp};
|
|||
use crate::common::{Direction, Rect};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::{Player, TargetPlayer};
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::player::{TargetPlayer};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::weapon::bullet::BulletManager;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n117_curly(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -126,13 +123,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n118_curly_boss(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
bullet_manager: &BulletManager,
|
||||
) -> GameResult {
|
||||
pub(crate) fn tick_n118_curly_boss(&mut self, state: &mut SharedGameState, NPCContext { players, npc_list, bullet_manager, .. }: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -269,7 +260,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n123_curly_boss_bullet(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n123_curly_boss_bullet(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
state.create_caret(self.x, self.y, CaretType::Shoot, Direction::Left);
|
||||
|
@ -321,7 +312,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n165_curly_collapsed(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -356,8 +347,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n180_curly_ai(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
|
@ -569,8 +559,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n181_curly_ai_machine_gun(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
bullet_manager: &mut BulletManager,
|
||||
NPCContext { npc_list, bullet_manager, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if let Some(parent) = self.get_parent_ref_mut(npc_list) {
|
||||
if parent.anim_num > 4 {
|
||||
|
@ -581,12 +570,12 @@ impl NPC {
|
|||
} else {
|
||||
self.x = parent.x
|
||||
+ if parent.direction == Direction::Left {
|
||||
self.direction = Direction::Left;
|
||||
-0x1000
|
||||
} else {
|
||||
self.direction = Direction::Right;
|
||||
0x1000
|
||||
};
|
||||
self.direction = Direction::Left;
|
||||
-0x1000
|
||||
} else {
|
||||
self.direction = Direction::Right;
|
||||
0x1000
|
||||
};
|
||||
self.y = parent.y;
|
||||
self.anim_num = 0;
|
||||
}
|
||||
|
@ -663,8 +652,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n182_curly_ai_polar_star(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
bullet_manager: &mut BulletManager,
|
||||
NPCContext { npc_list, bullet_manager, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if let Some(parent) = self.get_parent_ref_mut(npc_list) {
|
||||
if parent.anim_num > 4 {
|
||||
|
@ -675,12 +663,12 @@ impl NPC {
|
|||
} else {
|
||||
self.x = parent.x
|
||||
+ if parent.direction == Direction::Left {
|
||||
self.direction = Direction::Left;
|
||||
-0x1000
|
||||
} else {
|
||||
self.direction = Direction::Right;
|
||||
0x1000
|
||||
};
|
||||
self.direction = Direction::Left;
|
||||
-0x1000
|
||||
} else {
|
||||
self.direction = Direction::Right;
|
||||
0x1000
|
||||
};
|
||||
self.y = parent.y;
|
||||
self.anim_num = 0;
|
||||
}
|
||||
|
@ -756,7 +744,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n183_curly_air_tank_bubble(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if let Some(parent) = self.get_parent_ref_mut(npc_list) {
|
||||
if self.action_num == 0 {
|
||||
|
@ -783,8 +771,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n259_curly_unconscious(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -834,7 +821,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n303_curly_machine_gun(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if let Some(parent) = self.get_parent_ref_mut(npc_list) {
|
||||
self.x = parent.x;
|
||||
|
@ -862,8 +849,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n320_curly_carried(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = &players[0];
|
||||
|
||||
|
@ -912,9 +898,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n321_curly_nemesis(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
bullet_manager: &mut BulletManager,
|
||||
NPCContext { players, npc_list, bullet_manager, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if let Some(npc) = self.get_parent_ref_mut(npc_list) {
|
||||
let player = &players[0];
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
use crate::common::{CDEG_RAD, Direction, Rect};
|
||||
use crate::common::{Direction, Rect, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n139_doctor(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n139_doctor(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -119,7 +116,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n256_doctor_facing_away(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -208,7 +205,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n257_red_crystal(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n257_red_crystal(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
}
|
||||
|
@ -263,8 +260,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n263_doctor_boss(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -486,8 +482,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n264_doctor_boss_red_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.x < 0 || self.x > stage.map.width as i32 * state.tile_size.as_int() * 0x200 {
|
||||
self.vanish(state);
|
||||
|
@ -531,7 +526,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n265_doctor_boss_red_projectile_trail(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n265_doctor_boss_red_projectile_trail(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
self.anim_counter += 1;
|
||||
if self.anim_counter > 3 {
|
||||
self.anim_counter = 0;
|
||||
|
@ -550,7 +549,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n266_doctor_boss_red_projectile_bouncing(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.flags.hit_left_wall() {
|
||||
self.vel_x = -self.vel_x;
|
||||
|
@ -599,8 +598,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n267_muscle_doctor(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 | 2 => {
|
||||
|
@ -661,7 +659,10 @@ impl NPC {
|
|||
if self.flags.hit_bottom_wall() {
|
||||
if self.life + 20 >= self.action_counter3 {
|
||||
self.animate(10, 1, 2);
|
||||
} else if player.flags.hit_bottom_wall() && player.x > self.x - 0x6000 && player.x < self.x + 0x6000 && self.anim_num != 6
|
||||
} else if player.flags.hit_bottom_wall()
|
||||
&& player.x > self.x - 0x6000
|
||||
&& player.x < self.x + 0x6000
|
||||
&& self.anim_num != 6
|
||||
{
|
||||
self.anim_num = 6;
|
||||
state.quake_counter = 10;
|
||||
|
@ -1034,7 +1035,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n269_red_bat_bouncing(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n269_red_bat_bouncing(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.vel_x2 = self.vel_x;
|
||||
|
@ -1068,7 +1069,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n270_doctor_red_energy(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.direction == Direction::Bottom || self.direction == Direction::Up {
|
||||
self.vel_y += self.direction.vector_y() * 0x40;
|
||||
|
@ -1129,7 +1130,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n281_doctor_energy_form(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
use num_traits::{abs, clamp};
|
||||
|
||||
use crate::common::{CDEG_RAD, Direction, Rect};
|
||||
use crate::common::{Direction, Rect, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::{Player, TargetPlayer};
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::player::{TargetPlayer};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::weapon::bullet::BulletManager;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n002_behemoth(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n002_behemoth(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.flags.hit_left_wall() {
|
||||
self.direction = Direction::Right;
|
||||
} else if self.flags.hit_right_wall() {
|
||||
|
@ -97,7 +99,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n005_green_critter(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -181,7 +183,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n006_green_beetle(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n006_green_beetle(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -268,7 +270,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n007_basil(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n007_basil(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
@ -330,7 +336,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n008_blue_beetle(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -387,7 +393,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n025_lift(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n025_lift(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -475,8 +481,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n058_basu(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -593,7 +598,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n084_basu_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n084_basu_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.x += self.vel_x;
|
||||
self.y += self.vel_y;
|
||||
|
||||
|
@ -621,8 +626,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n200_zombie_dragon(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num < 100 && self.life < 950 {
|
||||
self.action_num = 100;
|
||||
|
@ -721,14 +725,18 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n201_zombie_dragon_dead(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n201_zombie_dragon_dead(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
let dir_offset = if self.direction == Direction::Left { 0 } else { 1 };
|
||||
|
||||
self.anim_rect = state.constants.npc.n201_zombie_dragon_dead[dir_offset];
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n202_zombie_dragon_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n202_zombie_dragon_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
self.y += self.vel_y;
|
||||
self.x += self.vel_x;
|
||||
|
||||
|
@ -747,7 +755,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n203_critter_destroyed_egg_corridor(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -847,8 +855,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n204_small_falling_spike(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -908,9 +915,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n205_large_falling_spike(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
bullet_manager: &mut BulletManager,
|
||||
NPCContext { players, npc_list, bullet_manager, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1003,8 +1008,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n206_counter_bomb(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1104,7 +1108,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n207_counter_bomb_countdown(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n207_counter_bomb_countdown(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -1138,8 +1146,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n208_basu_destroyed_egg_corridor(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -1258,6 +1265,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n209_basu_projectile_destroyed_egg_corridor(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
self.x += self.vel_x;
|
||||
self.y += self.vel_y;
|
||||
|
@ -1286,7 +1294,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n210_beetle_destroyed_egg_corridor(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
|
|
@ -2,13 +2,16 @@ use num_traits::clamp;
|
|||
|
||||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n059_eye_door(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n059_eye_door(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -72,7 +75,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n064_first_cave_critter(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -164,7 +167,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n065_first_cave_bat(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
|
|
@ -4,8 +4,8 @@ use num_traits::clamp;
|
|||
use crate::common::{Direction, Rect, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::{NPC, NPCList};
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::NPCContext;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
|
@ -13,7 +13,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n024_power_critter(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -144,7 +144,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n026_bat_flying(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -153,13 +153,11 @@ impl NPC {
|
|||
if self.action_num == 0 {
|
||||
let angle = self.rng.range(0..0xff) as f64 * CDEG_RAD;
|
||||
self.vel_x = (angle.cos() * 512.0) as i32;
|
||||
self.target_x =
|
||||
self.x + ((angle + 64.0 * CDEG_RAD).cos() * 8.0 * 512.0) as i32;
|
||||
self.target_x = self.x + ((angle + 64.0 * CDEG_RAD).cos() * 8.0 * 512.0) as i32;
|
||||
|
||||
let angle = self.rng.range(0..0xff) as f64 * CDEG_RAD;
|
||||
self.vel_y = (angle.sin() * 512.0) as i32;
|
||||
self.target_y =
|
||||
self.y + ((angle + 64.0 * CDEG_RAD).sin() * 8.0 * 512.0) as i32;
|
||||
self.target_y = self.y + ((angle + 64.0 * CDEG_RAD).sin() * 8.0 * 512.0) as i32;
|
||||
|
||||
self.action_num = 1;
|
||||
self.action_counter2 = 120;
|
||||
|
@ -216,7 +214,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n028_flying_critter(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -349,7 +347,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n031_bat_hanging(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -434,7 +432,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n035_mannan(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n035_mannan(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num <= 2 && self.life < 90 {
|
||||
self.action_num = 3;
|
||||
self.action_counter = 0;
|
||||
|
@ -489,7 +491,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n094_kulala(&mut self, state: &SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n094_kulala(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.anim_num = 4;
|
||||
|
@ -596,7 +602,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n095_jelly(&mut self, state: &SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n095_jelly(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 | 10 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -685,7 +691,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n100_grate(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n100_grate(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.y += 0x2000;
|
||||
self.action_num = 1;
|
||||
|
@ -700,14 +706,14 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n101_malco_screen(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n101_malco_screen(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.animate(3, 0, 2);
|
||||
self.anim_rect = state.constants.npc.n101_malco_screen[self.anim_num as usize];
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n102_malco_computer_wave(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n102_malco_computer_wave(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y += 0x1000;
|
||||
|
@ -719,7 +725,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n103_mannan_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n103_mannan_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
}
|
||||
|
@ -746,7 +752,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n104_frog(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n104_frog(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
match self.action_num {
|
||||
|
@ -833,7 +843,8 @@ impl NPC {
|
|||
&& self.action_num != 3
|
||||
&& self.action_counter > 10
|
||||
&& ((self.shock > 0)
|
||||
|| (abs(self.x - player.x) <= 0x14000 && abs(self.y - player.y) <= 0x8000) && self.rng.range(0..50) == 2)
|
||||
|| (abs(self.x - player.x) <= 0x14000 && abs(self.y - player.y) <= 0x8000)
|
||||
&& self.rng.range(0..50) == 2)
|
||||
{
|
||||
self.direction = if self.x >= player.x { Direction::Left } else { Direction::Right };
|
||||
self.action_num = 10;
|
||||
|
@ -857,7 +868,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n107_malco_broken(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n107_malco_broken(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -1022,8 +1037,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n109_malco_powered_on(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1086,7 +1100,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n110_puchi(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n110_puchi(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
match self.action_num {
|
||||
|
@ -1174,7 +1192,8 @@ impl NPC {
|
|||
&& self.action_num != 3
|
||||
&& self.action_counter > 10
|
||||
&& ((self.shock > 0)
|
||||
|| (abs(self.x - player.x) <= 0x14000 && abs(self.y - player.y) <= 0x8000) && self.rng.range(0..50) == 2)
|
||||
|| (abs(self.x - player.x) <= 0x14000 && abs(self.y - player.y) <= 0x8000)
|
||||
&& self.rng.range(0..50) == 2)
|
||||
{
|
||||
self.direction = if self.x >= player.x { Direction::Left } else { Direction::Right };
|
||||
self.action_num = 10;
|
||||
|
@ -1200,8 +1219,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n115_ravil(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1215,9 +1233,9 @@ impl NPC {
|
|||
let player = self.get_closest_player_mut(players);
|
||||
if self.shock != 0
|
||||
|| (player.x < self.x + 0xc000
|
||||
&& player.x > self.x - 0xc000
|
||||
&& player.y < self.y + 0x4000
|
||||
&& player.y > self.y - 0xc000)
|
||||
&& player.x > self.x - 0xc000
|
||||
&& player.y < self.y + 0x4000
|
||||
&& player.y > self.y - 0xc000)
|
||||
{
|
||||
self.action_num = 10;
|
||||
}
|
||||
|
@ -1334,7 +1352,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n192_scooter(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n192_scooter(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -1425,7 +1443,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n193_broken_scooter(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n193_broken_scooter(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.x += 0x3000;
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n337_numahachi(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n337_numahachi(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y -= 0x1000;
|
||||
|
@ -36,7 +33,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n357_puppy_ghost(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n357_puppy_ghost(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_rect = state.constants.npc.n357_puppy_ghost;
|
||||
|
||||
match self.action_num {
|
||||
|
@ -75,7 +72,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n309_bute(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n309_bute(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
match self.action_num {
|
||||
|
@ -136,7 +137,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n310_bute_sword(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -254,8 +255,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n311_bute_archer(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -265,7 +265,7 @@ impl NPC {
|
|||
|
||||
if (player.y > self.y - 0x14000 && player.y < self.y + 0x14000)
|
||||
&& ((self.direction == Direction::Left && player.x > self.x - 0x28000 && player.x < self.x)
|
||||
|| (self.direction != Direction::Left && player.x > self.x && player.x < self.x + 0x28000))
|
||||
|| (self.direction != Direction::Left && player.x > self.x && player.x < self.x + 0x28000))
|
||||
{
|
||||
self.action_num = 10;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n312_bute_arrow_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n312_bute_arrow_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.flags.hit_anything() && self.action_num > 0 && self.action_num < 20 {
|
||||
self.action_num = 20;
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n316_bute_dead(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n316_bute_dead(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
// (nearly) same as Gaudi death
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -486,7 +486,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n323_bute_spinning(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 || self.action_num == 1 {
|
||||
if self.action_num == 0 {
|
||||
|
@ -511,9 +511,9 @@ impl NPC {
|
|||
let player = self.get_closest_player_ref(&players);
|
||||
if self.action_counter > 20
|
||||
&& ((self.direction == Direction::Left && self.x <= player.x + 0x4000)
|
||||
|| (self.direction == Direction::Up && self.y <= player.y + 0x4000)
|
||||
|| (self.direction == Direction::Right && self.x >= player.x - 0x4000)
|
||||
|| (self.direction == Direction::Bottom && self.y >= player.y - 0x4000))
|
||||
|| (self.direction == Direction::Up && self.y <= player.y + 0x4000)
|
||||
|| (self.direction == Direction::Right && self.x >= player.x - 0x4000)
|
||||
|| (self.direction == Direction::Bottom && self.y >= player.y - 0x4000))
|
||||
{
|
||||
self.action_num = 10
|
||||
}
|
||||
|
@ -534,7 +534,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n324_bute_generator(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n324_bute_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 10 {
|
||||
self.action_num = 11;
|
||||
self.action_counter = 0;
|
||||
|
@ -563,8 +567,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n317_mesa(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
|
@ -644,7 +647,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n318_mesa_dead(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n318_mesa_dead(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
// (nearly) same as Gaudi death
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -688,7 +691,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n319_mesa_block(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n319_mesa_block(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
if let Some(parent) = self.get_parent_ref_mut(npc_list) {
|
||||
|
@ -739,8 +746,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n322_deleet(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num < 2 && self.life <= 968 {
|
||||
self.action_num = 2;
|
||||
|
@ -844,7 +850,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n330_rolling(&mut self, state: &mut SharedGameState, npc_list: &NPCList, stage: &mut Stage) -> GameResult {
|
||||
pub(crate) fn tick_n330_rolling(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
let x = (self.x / (state.tile_size.as_int() * 0x200)) as usize;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
use crate::common::{CDEG_RAD, Direction};
|
||||
use crate::common::{Direction, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n083_igor_cutscene(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n083_igor_cutscene(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -89,8 +87,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n088_igor_boss(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -273,8 +270,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n089_igor_dead(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -389,8 +385,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n268_igor_enemy(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n298_intro_doctor(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n298_intro_doctor(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -82,7 +82,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n299_intro_balrog_misery(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n299_intro_balrog_misery(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -101,18 +101,14 @@ impl NPC {
|
|||
}
|
||||
|
||||
self.action_counter += 1;
|
||||
self.y += if (self.action_counter / 50) % 2 != 0 {
|
||||
0x40
|
||||
} else {
|
||||
-0x40
|
||||
};
|
||||
self.y += if (self.action_counter / 50) % 2 != 0 { 0x40 } else { -0x40 };
|
||||
|
||||
self.anim_rect = state.constants.npc.n299_intro_balrog_misery[self.anim_num as usize];
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n300_intro_demon_crown(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n300_intro_demon_crown(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y += 0xc00;
|
||||
|
@ -121,9 +117,12 @@ impl NPC {
|
|||
|
||||
self.anim_counter += 1;
|
||||
if (self.anim_counter % 8) == 1 {
|
||||
state.create_caret(self.x + state.effect_rng.range(-8..8) as i32 * 0x200,
|
||||
self.y + 0x1000,
|
||||
CaretType::LittleParticles, Direction::Up);
|
||||
state.create_caret(
|
||||
self.x + state.effect_rng.range(-8..8) as i32 * 0x200,
|
||||
self.y + 0x1000,
|
||||
CaretType::LittleParticles,
|
||||
Direction::Up,
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n241_critter_red(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -104,7 +101,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n242_bat_last_cave(&mut self, state: &mut SharedGameState, stage: &mut Stage) -> GameResult {
|
||||
pub(crate) fn tick_n242_bat_last_cave(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.x < 0 || self.x > stage.map.width as i32 * state.tile_size.as_int() * 0x200 {
|
||||
self.vanish(state);
|
||||
return Ok(());
|
||||
|
@ -148,7 +149,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n243_bat_generator(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n243_bat_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -176,7 +181,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n244_lava_drop(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n244_lava_drop(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
self.vel_y += 0x40;
|
||||
|
||||
// idfk why was that there in original code but I'll leave it there in case
|
||||
|
@ -215,7 +224,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n245_lava_drop_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -266,8 +275,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n276_red_demon(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 | 2 => {
|
||||
|
@ -441,7 +449,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n277_red_demon_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use crate::common::{CDEG_RAD, Direction};
|
||||
use crate::common::{Direction, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
|
@ -11,8 +9,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n147_critter_purple(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -159,7 +156,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n148_critter_purple_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n148_critter_purple_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.flags.hit_anything() {
|
||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
||||
self.cond.set_alive(false);
|
||||
|
@ -183,7 +184,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n153_gaudi(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n153_gaudi(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
if !(self.x <= player.x + 0x28000
|
||||
|
@ -332,7 +337,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n154_gaudi_dead(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n154_gaudi_dead(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.npc_flags.set_shootable(false);
|
||||
|
@ -382,8 +387,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n155_gaudi_flying(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -489,7 +493,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n156_gaudi_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n156_gaudi_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_counter > 300 || (self.flags.0 & 0xff) != 0 {
|
||||
self.cond.set_alive(false);
|
||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
||||
|
@ -508,8 +512,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n160_puu_black(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -638,7 +641,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n161_puu_black_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n161_puu_black_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.exp = 0;
|
||||
|
||||
self.vel_x = if self.x >= state.npc_super_pos.0 { self.vel_x - 64 } else { self.vel_x + 64 };
|
||||
|
@ -665,7 +668,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n166_chaba(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n166_chaba(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -698,8 +701,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n162_puu_black_dead(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -795,7 +797,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n163_dr_gero(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n163_dr_gero(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -827,7 +829,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n164_nurse_hasumi(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n164_nurse_hasumi(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -859,7 +861,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n168_boulder(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n168_boulder(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -912,8 +914,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n171_fire_whirrr(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
self.face_player(player);
|
||||
|
@ -977,7 +978,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n172_fire_whirrr_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n172_fire_whirrr_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
// pixel what?
|
||||
self.action_num = 1;
|
||||
|
@ -1001,8 +1006,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n173_gaudi_armored(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -1139,7 +1143,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n174_gaudi_armored_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n174_gaudi_armored_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.direction == Direction::Right {
|
||||
|
@ -1203,7 +1211,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n175_gaudi_egg(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n175_gaudi_egg(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num < 3 && self.life < 90 {
|
||||
self.cond.set_drs_novanish(true);
|
||||
self.cond.set_explode_die(true);
|
||||
|
@ -1233,8 +1241,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n176_buyo_buyo_base(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num < 3 && self.life < 940 {
|
||||
self.cond.set_drs_novanish(true);
|
||||
|
@ -1316,7 +1323,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n177_buyo_buyo(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n177_buyo_buyo(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.flags.hit_anything() {
|
||||
state.create_caret(self.x, self.y, CaretType::Shoot, Direction::Left);
|
||||
self.cond.set_alive(false);
|
||||
|
@ -1374,7 +1385,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n184_shutter(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n184_shutter(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -1429,7 +1444,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n185_small_shutter(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n185_small_shutter(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.anim_rect = state.constants.npc.n185_small_shutter;
|
||||
|
@ -1461,7 +1476,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n186_lift_block(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n186_lift_block(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -1493,8 +1508,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n187_fuzz_core(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
@ -1545,8 +1559,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n188_fuzz(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
@ -1594,7 +1607,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n304_gaudi_hospital(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n304_gaudi_hospital(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
|
|
@ -4,16 +4,13 @@ use num_traits::{abs, clamp};
|
|||
|
||||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::{Player, TargetPlayer};
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::player::{TargetPlayer};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::game::weapon::bullet::BulletManager;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n069_pignon(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n069_pignon(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -96,7 +93,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n071_chinfish(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n071_chinfish(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.target_x = self.x;
|
||||
|
@ -129,7 +126,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n075_kanpachi(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n075_kanpachi(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_num = 0;
|
||||
|
@ -154,7 +155,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n077_yamashita(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n077_yamashita(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_num = 0;
|
||||
|
@ -188,7 +189,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n079_mahin(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n079_mahin(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -237,7 +242,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n080_gravekeeper(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -332,7 +337,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n081_giant_pignon(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -420,7 +425,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n091_mimiga_cage(&mut self, state: &SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n091_mimiga_cage(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y += 0x2000;
|
||||
|
@ -433,9 +438,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n313_ma_pignon(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
bullet_manager: &mut BulletManager,
|
||||
NPCContext { players, npc_list, bullet_manager, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -716,9 +719,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n314_ma_pignon_rock(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &Stage,
|
||||
NPCContext { players, npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -783,8 +784,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n315_ma_pignon_clone(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
bullet_manager: &mut BulletManager,
|
||||
NPCContext { players, bullet_manager, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
use std::hint::unreachable_unchecked;
|
||||
|
||||
use crate::common::{Direction, Rect};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::{NPCLayer, NPC};
|
||||
use crate::game::npc::{NPCContext, NPCLayer, NPC};
|
||||
use crate::game::physics::HitExtents;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::shared_game_state::{GameDifficulty, SharedGameState};
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n000_null(&mut self) -> GameResult {
|
||||
pub(crate) fn tick_n000_null(&mut self, _: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -31,7 +26,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n003_dead_enemy(&mut self) -> GameResult {
|
||||
pub(crate) fn tick_n003_dead_enemy(&mut self, _: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num != 0xffff {
|
||||
self.action_num = 0xffff;
|
||||
self.action_counter2 = 0;
|
||||
|
@ -49,7 +44,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n004_smoke(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n004_smoke(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_num = self.rng.range(0..4) as u16;
|
||||
|
@ -92,14 +87,18 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n013_forcefield(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n013_forcefield(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_num = (self.anim_num + 1) % 4;
|
||||
self.anim_rect = state.constants.npc.n013_forcefield[self.anim_num as usize];
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n014_key(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n014_key(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -139,7 +138,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n015_chest_closed(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n015_chest_closed(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if state.difficulty == GameDifficulty::Hard && state.constants.missile_flags.contains(&self.flag_num) {
|
||||
self.cond.set_alive(false);
|
||||
return Ok(());
|
||||
|
@ -193,7 +196,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n016_save_point(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n016_save_point(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.npc_flags.set_interactable(true);
|
||||
self.action_num = 1;
|
||||
|
@ -233,7 +240,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n017_health_refill(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n017_health_refill(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -316,7 +327,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n018_door(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n018_door(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => match self.direction {
|
||||
Direction::Left => self.anim_rect = state.constants.npc.n018_door[0],
|
||||
|
@ -345,7 +360,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n020_computer(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n020_computer(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.direction {
|
||||
Direction::Left if self.anim_num == 0 => {
|
||||
self.anim_num = 1;
|
||||
|
@ -362,7 +377,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n021_chest_open(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n021_chest_open(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if state.difficulty == GameDifficulty::Hard && state.constants.missile_flags.contains(&self.flag_num) {
|
||||
self.cond.set_alive(false);
|
||||
return Ok(());
|
||||
|
@ -381,7 +396,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n022_teleporter(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n022_teleporter(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.anim_num = 0;
|
||||
|
@ -397,7 +412,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n023_teleporter_lights(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n023_teleporter_lights(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_counter += 1;
|
||||
if self.anim_counter > 1 {
|
||||
self.anim_counter = 0;
|
||||
|
@ -412,7 +427,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n027_death_trap(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n027_death_trap(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n027_death_trap;
|
||||
|
@ -421,7 +436,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n030_gunsmith(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n030_gunsmith(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.direction == Direction::Left {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -463,7 +478,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n032_life_capsule(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n032_life_capsule(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if state.difficulty == GameDifficulty::Hard {
|
||||
self.cond.set_alive(false);
|
||||
return Ok(());
|
||||
|
@ -476,7 +491,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n034_bed(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n034_bed(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -490,7 +505,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n037_sign(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n037_sign(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_counter = (self.anim_counter + 1) % 4;
|
||||
self.anim_num = self.anim_counter / 2;
|
||||
self.anim_rect = state.constants.npc.n037_sign[self.anim_num as usize];
|
||||
|
@ -498,7 +513,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n038_fireplace(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n038_fireplace(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.anim_counter = (self.anim_counter + 1) % 16;
|
||||
|
@ -527,7 +546,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n039_save_sign(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n039_save_sign(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -541,7 +560,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n041_busted_door(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n041_busted_door(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.layer = NPCLayer::Background;
|
||||
|
@ -552,7 +571,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n043_chalkboard(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n043_chalkboard(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y -= 0x2000;
|
||||
|
@ -570,7 +589,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n046_hv_trigger(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
// Nicalis
|
||||
if state.constants.is_cs_plus && self.tsc_direction != 0 {
|
||||
|
@ -595,7 +614,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n070_sparkle(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n070_sparkle(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_counter = (self.anim_counter + 1) % 16;
|
||||
self.anim_num = self.anim_counter / 4;
|
||||
self.anim_rect = state.constants.npc.n070_sparkle[self.anim_num as usize];
|
||||
|
@ -606,8 +625,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n072_sprinkler(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.direction == Direction::Left {
|
||||
self.animate(1, 0, 2);
|
||||
|
@ -642,7 +660,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n073_water_droplet(&mut self, state: &mut SharedGameState, stage: &Stage) -> GameResult {
|
||||
pub(crate) fn tick_n073_water_droplet(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
self.vel_y += 0x20;
|
||||
|
||||
self.anim_rect = state.constants.npc.n073_water_droplet[self.rng.range(0..4) as usize];
|
||||
|
@ -676,7 +698,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n076_flowers(&mut self) -> GameResult {
|
||||
pub(crate) fn tick_n076_flowers(&mut self, _: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -689,7 +711,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n078_pot(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n078_pot(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -703,7 +725,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n085_terminal(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n085_terminal(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.anim_num = 0;
|
||||
|
@ -730,7 +756,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n090_background(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n090_background(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n090_background;
|
||||
|
@ -742,8 +768,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n096_fan_left(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -802,8 +827,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n097_fan_up(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -861,8 +885,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n098_fan_right(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -917,8 +940,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n099_fan_down(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -969,7 +991,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n105_hey_bubble_low(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n105_hey_bubble_low(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.action_counter += 1;
|
||||
|
||||
if self.action_counter < 5 {
|
||||
|
@ -983,7 +1005,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n106_hey_bubble_high(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n106_hey_bubble_high(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -1001,8 +1027,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n114_press(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1073,7 +1098,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n116_red_petals(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n116_red_petals(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n116_red_petals;
|
||||
|
@ -1082,7 +1107,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n119_table_chair(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n119_table_chair(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n119_table_chair;
|
||||
|
@ -1091,7 +1116,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n125_hidden_item(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n125_hidden_item(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.life < 990 {
|
||||
npc_list.create_death_smoke(self.x, self.y, self.display_bounds.right as usize, 8, state, &self.rng);
|
||||
self.cond.set_alive(false);
|
||||
|
@ -1129,7 +1158,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n137_large_door_frame(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n137_large_door_frame(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n137_large_door_frame;
|
||||
|
@ -1141,8 +1170,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n146_lightning(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
flash: &mut Flash,
|
||||
NPCContext { npc_list, flash, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1185,8 +1213,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n149_horizontal_moving_block(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -1314,7 +1341,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n152_shutter_stuck(&mut self) -> GameResult {
|
||||
pub(crate) fn tick_n152_shutter_stuck(&mut self, _: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -1331,8 +1358,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n157_vertical_moving_block(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -1463,7 +1489,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n189_homing_flame(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
|
@ -1504,7 +1530,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n190_broken_robot(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n190_broken_robot(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => self.anim_num = 0,
|
||||
10 => {
|
||||
|
@ -1532,7 +1562,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n191_water_level(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n191_water_level(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 10 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -1588,7 +1618,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n194_broken_blue_robot(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n194_broken_blue_robot(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y += 0x800;
|
||||
|
@ -1599,7 +1629,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n195_background_grate(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n195_background_grate(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.layer = NPCLayer::Background;
|
||||
self.action_num = 1;
|
||||
|
@ -1609,7 +1639,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n199_wind_particles(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n199_wind_particles(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_num = self.rng.range(0..2) as u16;
|
||||
|
@ -1637,7 +1667,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n211_small_spikes(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n211_small_spikes(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n211_small_spikes[self.event_num as usize % 4];
|
||||
|
@ -1646,7 +1676,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n216_debug_cat(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n216_debug_cat(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n216_debug_cat;
|
||||
|
@ -1655,7 +1685,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n219_smoke_generator(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n219_smoke_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.direction != Direction::Left {
|
||||
let mut npc = NPC::create(199, &state.npc_table);
|
||||
npc.x = self.x + self.rng.range(-160..160) * 0x200;
|
||||
|
@ -1678,7 +1712,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n222_prison_bars(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n222_prison_bars(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.y -= 0x1000;
|
||||
|
||||
|
@ -1689,7 +1723,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n227_bucket(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n227_bucket(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n227_bucket;
|
||||
|
@ -1698,7 +1732,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n229_red_flowers_sprouts(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n229_red_flowers_sprouts(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y -= 0x2000;
|
||||
|
@ -1711,7 +1745,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n230_red_flowers_blooming(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n230_red_flowers_blooming(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.x -= 0x2000;
|
||||
|
@ -1725,7 +1759,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n234_red_flowers_picked(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n234_red_flowers_picked(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.y += 0x2000;
|
||||
|
@ -1743,8 +1777,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n238_press_sideways(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
|
@ -1839,7 +1872,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n239_cage_bars(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n239_cage_bars(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
if self.direction == Direction::Left {
|
||||
|
@ -1862,8 +1895,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n246_press_proximity(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1951,7 +1983,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n253_experience_capsule(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
@ -1973,7 +2005,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n258_mimiga_sleeping(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n258_mimiga_sleeping(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n258_mimiga_sleeping;
|
||||
|
@ -1982,7 +2014,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n271_ironhead_block(&mut self, state: &mut SharedGameState, stage: &mut Stage) -> GameResult {
|
||||
pub(crate) fn tick_n271_ironhead_block(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.vel_x < 0 && self.x < -0x2000
|
||||
|| self.vel_x > 0 && self.x > stage.map.width as i32 * state.tile_size.as_int() * 0x200 + 0x2000
|
||||
{
|
||||
|
@ -2029,7 +2065,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n272_ironhead_block_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
@ -2059,9 +2095,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n279_large_falling_block(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { players, npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 10 | 11 => {
|
||||
|
@ -2157,7 +2191,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n292_quake(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n292_quake(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
state.quake_counter = 10;
|
||||
|
||||
Ok(())
|
||||
|
@ -2166,9 +2200,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n294_quake_falling_block_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { players, npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -2224,7 +2256,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n295_cloud(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n295_cloud(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_num = self.tsc_direction % 4;
|
||||
|
@ -2290,7 +2322,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n296_cloud_generator(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n296_cloud_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
self.action_counter += 1;
|
||||
if self.action_counter <= 16 {
|
||||
return Ok(());
|
||||
|
@ -2336,7 +2372,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n297_sue_dragon_mouth(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n297_sue_dragon_mouth(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if let Some(npc) = self.get_parent_ref_mut(npc_list) {
|
||||
self.x = npc.x + 0x2000;
|
||||
self.y = npc.y + 0x1000;
|
||||
|
@ -2350,9 +2390,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n302_camera_focus_marker(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
mut players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
boss: &mut BossNPC,
|
||||
NPCContext { mut players, npc_list, boss, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = &mut players[state.textscript_vm.executor_player.index()];
|
||||
|
||||
|
@ -2411,7 +2449,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n328_human_transform_machine(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n328_human_transform_machine(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_rect = state.constants.npc.n328_human_transform_machine;
|
||||
|
@ -2420,14 +2462,18 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n329_laboratory_fan(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n329_laboratory_fan(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_counter = self.anim_counter.wrapping_add(1);
|
||||
self.anim_rect = state.constants.npc.n329_laboratory_fan[(self.anim_counter as usize / 2) & 1];
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n334_sweat(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n334_sweat(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
match self.action_num {
|
||||
|
@ -2459,7 +2505,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n349_statue(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n349_statue(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -2475,7 +2521,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n351_statue_shootable(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n351_statue_shootable(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -2519,7 +2569,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n352_ending_characters(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
@ -2573,7 +2623,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n355_quote_and_curly_on_balrog(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
match (self.tsc_direction, self.direction) {
|
||||
|
@ -2663,7 +2713,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n358_misery_credits(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n358_misery_credits(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.animate(6, 0, 1);
|
||||
} else if self.action_num == 10 {
|
||||
|
@ -2678,8 +2728,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n359_water_droplet_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
if (player.x - self.x).abs() < 0x28000
|
||||
|
@ -2698,7 +2747,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n360_credits_thank_you(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n360_credits_thank_you(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.x -= 0x1000;
|
||||
|
|
|
@ -2,20 +2,19 @@ use std::hint::unreachable_unchecked;
|
|||
|
||||
use num_traits::clamp;
|
||||
|
||||
use crate::common::{CDEG_RAD, Direction};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::common::{Direction, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n066_misery_bubble(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n066_misery_bubble(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -24,7 +23,7 @@ impl NPC {
|
|||
self.target_x = npc.x;
|
||||
self.target_y = npc.y;
|
||||
|
||||
let angle = f64::atan2((self.y - self.target_y) as f64, (self.x - self.target_x) as f64);
|
||||
let angle = f64::atan2((self.y - self.target_y) as f64, (self.x - self.target_x) as f64);
|
||||
self.vel_x = (angle.cos() * -1024.0) as i32;
|
||||
self.vel_y = (angle.sin() * -1024.0) as i32;
|
||||
}
|
||||
|
@ -76,8 +75,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n067_misery_floating(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
flash: &mut Flash,
|
||||
NPCContext { npc_list, flash, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -234,8 +232,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n082_misery_standing(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
flash: &mut Flash,
|
||||
NPCContext { npc_list, flash, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -416,8 +413,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n247_misery_boss(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -614,7 +610,8 @@ impl NPC {
|
|||
}
|
||||
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
self.action_num = if player.x >= self.x - 0xe000 && player.x <= self.x + 0xe000 { 100 } else { 160 };
|
||||
self.action_num =
|
||||
if player.x >= self.x - 0xe000 && player.x <= self.x + 0xe000 { 100 } else { 160 };
|
||||
}
|
||||
}
|
||||
160 | 161 => {
|
||||
|
@ -702,7 +699,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n248_misery_boss_vanishing(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n248_misery_boss_vanishing(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.flags.hit_anything() {
|
||||
self.cond.set_alive(false);
|
||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
||||
|
@ -723,7 +720,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n249_misery_boss_appearing(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n249_misery_boss_appearing(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.action_counter2 += 1;
|
||||
if self.action_counter2 > 8 {
|
||||
self.cond.set_alive(false);
|
||||
|
@ -743,8 +740,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n250_misery_boss_lightning_ball(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -807,7 +803,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n251_misery_boss_lightning(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
@ -831,8 +827,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n252_misery_boss_bats(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -852,10 +847,10 @@ impl NPC {
|
|||
if let Some(parent) = self.get_parent_ref_mut(npc_list) {
|
||||
self.x = parent.x
|
||||
+ self.action_counter as i32 * ((self.action_counter2 as f64 * CDEG_RAD).cos() * 512.0) as i32
|
||||
/ 4;
|
||||
/ 4;
|
||||
self.y = parent.y
|
||||
+ self.action_counter as i32 * ((self.action_counter2 as f64 * CDEG_RAD).sin() * 512.0) as i32
|
||||
/ 4;
|
||||
/ 4;
|
||||
|
||||
if parent.action_num == 151 {
|
||||
self.action_num = 10;
|
||||
|
@ -912,14 +907,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n283_misery_possessed(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
boss: &mut BossNPC,
|
||||
) -> GameResult {
|
||||
pub(crate) fn tick_n283_misery_possessed(&mut self, state: &mut SharedGameState, NPCContext { players, npc_list, stage, boss, .. }: NPCContext) -> GameResult {
|
||||
if self.action_num < 100 && (!boss.parts[0].cond.alive() || self.life < 400) {
|
||||
self.action_num = 100;
|
||||
}
|
||||
|
@ -1147,12 +1135,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n289_critter_orange(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
stage: &mut Stage,
|
||||
) -> GameResult {
|
||||
pub(crate) fn tick_n289_critter_orange(&mut self, state: &mut SharedGameState, NPCContext { players, stage, .. }: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -1229,12 +1212,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n290_bat_misery(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
stage: &mut Stage,
|
||||
) -> GameResult {
|
||||
pub(crate) fn tick_n290_bat_misery(&mut self, state: &mut SharedGameState, NPCContext { players, stage, .. }: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -1293,7 +1271,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n301_misery_fish_missile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
|
|
@ -2,9 +2,7 @@ use num_traits::abs;
|
|||
|
||||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
|
@ -12,8 +10,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n212_sky_dragon(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -104,8 +101,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n213_night_spirit(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
// Nicalis
|
||||
if state.constants.is_cs_plus && self.tsc_direction != 0 {
|
||||
|
@ -215,7 +211,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n214_night_spirit_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
@ -248,7 +244,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n215_sandcroc_outer_wall(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -331,7 +327,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n347_hoppy(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n347_hoppy(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::{BackgroundType, Stage};
|
||||
use crate::game::stage::BackgroundType;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n001_experience(&mut self, state: &mut SharedGameState, stage: &mut Stage) -> GameResult {
|
||||
if stage.data.background_type == BackgroundType::Scrolling || stage.data.background_type == BackgroundType::OutsideWind {
|
||||
pub(crate) fn tick_n001_experience(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if stage.data.background_type == BackgroundType::Scrolling
|
||||
|| stage.data.background_type == BackgroundType::OutsideWind
|
||||
{
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
||||
|
@ -138,7 +144,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n086_missile_pickup(&mut self, state: &mut SharedGameState, stage: &mut Stage) -> GameResult {
|
||||
pub(crate) fn tick_n086_missile_pickup(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.direction == Direction::Left {
|
||||
self.anim_counter += 1;
|
||||
if self.anim_counter > 2 {
|
||||
|
@ -152,7 +162,9 @@ impl NPC {
|
|||
self.action_counter2 += 1;
|
||||
}
|
||||
|
||||
if stage.data.background_type == BackgroundType::Scrolling || stage.data.background_type == BackgroundType::OutsideWind {
|
||||
if stage.data.background_type == BackgroundType::Scrolling
|
||||
|| stage.data.background_type == BackgroundType::OutsideWind
|
||||
{
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.vel_x = self.rng.range(0x7f..0x100) as i32;
|
||||
|
@ -206,7 +218,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n087_heart_pickup(&mut self, state: &mut SharedGameState, stage: &mut Stage) -> GameResult {
|
||||
pub(crate) fn tick_n087_heart_pickup(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.direction == Direction::Left {
|
||||
self.anim_counter += 1;
|
||||
if self.anim_counter > 2 {
|
||||
|
@ -220,7 +236,9 @@ impl NPC {
|
|||
self.action_counter2 += 1;
|
||||
}
|
||||
|
||||
if stage.data.background_type == BackgroundType::Scrolling || stage.data.background_type == BackgroundType::OutsideWind {
|
||||
if stage.data.background_type == BackgroundType::Scrolling
|
||||
|| stage.data.background_type == BackgroundType::OutsideWind
|
||||
{
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.vel_x = self.rng.range(0x7f..0x100) as i32;
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
use crate::common::{CDEG_RAD, Direction};
|
||||
use crate::common::{Direction, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n220_shovel_brigade(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n220_shovel_brigade(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -40,7 +38,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n221_shovel_brigade_walking(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n221_shovel_brigade_walking(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -117,7 +119,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n223_momorin(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n223_momorin(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -162,7 +168,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n224_chie(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n224_chie(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -203,7 +213,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n225_megane(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n225_megane(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
self.anim_num = 0;
|
||||
|
@ -232,7 +242,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n226_kanpachi_plantation(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n226_kanpachi_plantation(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -285,7 +295,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n228_droll(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n228_droll(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -364,8 +378,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n231_rocket(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -476,7 +489,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n232_orangebell(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n232_orangebell(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -530,8 +547,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n233_orangebell_bat(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -606,7 +622,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n235_midorin(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n235_midorin(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -687,8 +703,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n236_gunfish(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -789,7 +804,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n237_gunfish_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n237_gunfish_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
}
|
||||
|
@ -821,7 +836,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n240_mimiga_jailed(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n240_mimiga_jailed(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -893,7 +908,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n273_droll_projectile(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n273_droll_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
}
|
||||
|
@ -935,8 +954,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n274_droll(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 | 2 => {
|
||||
|
@ -1044,7 +1062,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n275_puppy_plantation(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1091,7 +1109,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n308_stumpy(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n308_stumpy(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
self.action_num = 1;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
|
@ -10,7 +8,7 @@ impl NPC {
|
|||
pub fn tick_n111_quote_teleport_out(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -83,7 +81,7 @@ impl NPC {
|
|||
pub fn tick_n112_quote_teleport_in(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -145,8 +143,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n150_quote(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -316,8 +313,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n370_second_quote(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if !players[1].cond.alive() {
|
||||
self.cond.set_alive(false);
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
use num_traits::{abs, clamp};
|
||||
|
||||
use crate::common::{CDEG_RAD, Direction};
|
||||
use crate::common::{Direction, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::weapon::bullet::BulletManager;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n044_polish(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n044_polish(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 | 2 => {
|
||||
if self.action_num <= 1 {
|
||||
|
@ -151,7 +152,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n045_baby(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n045_baby(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 2;
|
||||
self.vel_x = if self.rng.next_u16() & 1 != 0 {
|
||||
|
@ -210,7 +211,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n047_sandcroc(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n047_sandcroc(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -291,8 +296,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n049_skullhead(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let parent = self.get_parent_ref_mut(npc_list);
|
||||
|
||||
|
@ -407,7 +411,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n050_skeleton_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n050_skeleton_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 && self.direction == Direction::Right {
|
||||
|
@ -478,8 +482,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n051_crow_and_skullhead(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -565,7 +568,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n053_skullstep_leg(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n053_skullstep_leg(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let parent = self.get_parent_ref_mut(npc_list);
|
||||
if parent.is_none() || parent.as_ref().unwrap().npc_type == 3 {
|
||||
self.vanish(state);
|
||||
|
@ -613,7 +620,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n054_skullstep(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n054_skullstep(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -696,7 +707,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n056_tan_beetle(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -764,7 +775,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n057_crow(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n057_crow(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -856,7 +871,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n120_colon_a(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n120_colon_a(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
let anim = if self.direction == Direction::Left { 0 } else { 1 };
|
||||
|
||||
self.anim_rect = state.constants.npc.n120_colon_a[anim];
|
||||
|
@ -864,7 +879,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n121_colon_b(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n121_colon_b(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.direction != Direction::Left {
|
||||
self.anim_rect = state.constants.npc.n121_colon_b[2];
|
||||
|
||||
|
@ -909,7 +924,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n122_colon_enraged(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1036,7 +1051,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n124_sunstone(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n124_sunstone(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -1084,7 +1099,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n126_puppy_running(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1180,7 +1195,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n130_puppy_sitting(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1248,7 +1263,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n131_puppy_sleeping(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n131_puppy_sleeping(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.action_counter += 1;
|
||||
if self.action_counter > 100 {
|
||||
self.action_counter = 0;
|
||||
|
@ -1265,7 +1280,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n132_puppy_barking(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
match self.action_num {
|
||||
|
@ -1368,7 +1383,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n133_jenka(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n133_jenka(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -1403,7 +1418,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n136_puppy_carried(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1453,8 +1468,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n134_armadillo(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
bullet_manager: &BulletManager,
|
||||
NPCContext { players, bullet_manager, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -1527,8 +1541,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n135_skeleton(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -1626,7 +1639,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n138_large_door(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n138_large_door(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num != 1 {
|
||||
if self.action_num > 1 {
|
||||
if self.action_num == 10 {
|
||||
|
@ -1681,7 +1694,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n143_jenka_collapsed(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n143_jenka_collapsed(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
let anim = if self.direction == Direction::Left { 0 } else { 1 };
|
||||
|
||||
self.anim_rect = state.constants.npc.n143_jenka_collapsed[anim];
|
||||
|
|
|
@ -2,13 +2,16 @@ use num_traits::abs;
|
|||
|
||||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n040_santa(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n040_santa(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -67,7 +70,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n307_santa_caged(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n307_santa_caged(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub fn tick_n042_sue(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -225,7 +220,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n092_sue_at_pc(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n092_sue_at_pc(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -282,7 +277,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n280_sue_teleported(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n280_sue_teleported(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -335,10 +330,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n284_sue_possessed(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
boss: &mut BossNPC,
|
||||
NPCContext { players, npc_list, stage, boss, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num < 100 && (!boss.parts[0].cond.alive() || self.life < 500) {
|
||||
self.action_num = 100;
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::weapon::bullet::BulletManager;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n060_toroko(&mut self, state: &mut SharedGameState, players: [&mut Player; 2]) -> GameResult {
|
||||
pub(crate) fn tick_n060_toroko(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -168,7 +169,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n063_toroko_stick(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n063_toroko_stick(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -273,9 +274,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n140_toroko_frenzied(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
bullet_manager: &BulletManager,
|
||||
NPCContext { players, npc_list, bullet_manager, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -587,8 +586,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n141_toroko_block_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -688,7 +686,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n142_flower_cub(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
10 | 11 => {
|
||||
|
@ -755,7 +753,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n144_toroko_teleporting_in(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n144_toroko_teleporting_in(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::common::Direction;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n127_machine_gun_trail_l2(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n127_machine_gun_trail_l2(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_counter += 1;
|
||||
if self.anim_counter > 0 {
|
||||
self.anim_counter = 0;
|
||||
|
@ -29,7 +29,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n128_machine_gun_trail_l3(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n128_machine_gun_trail_l3(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_counter += 1;
|
||||
if self.anim_counter > 0 {
|
||||
self.anim_counter = 0;
|
||||
|
@ -76,7 +76,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n129_fireball_snake_trail(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n129_fireball_snake_trail(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.anim_counter += 1;
|
||||
|
||||
if self.anim_counter > 1 {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use crate::common::{CDEG_RAD, Direction};
|
||||
use crate::common::{Direction, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
|
@ -12,7 +10,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n361_flying_gaudi(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -82,8 +80,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n362_curly_clone(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
|
@ -231,7 +228,11 @@ impl NPC {
|
|||
}
|
||||
|
||||
// Dead Curly Clone
|
||||
pub(crate) fn tick_n363_dead_curly_clone(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n363_dead_curly_clone(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -287,7 +288,7 @@ impl NPC {
|
|||
}
|
||||
|
||||
// Fast, machine gun-like bullets shot by Curly clone (NPC 362)
|
||||
pub(crate) fn tick_n364_fast_bullet(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n364_fast_bullet(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
self.action_num = 1;
|
||||
|
@ -336,8 +337,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n365_still_curly_clone(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
|
@ -411,7 +411,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n366_zombie_curly_clone(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
if self.x > player.x + 0x28000
|
||||
|
@ -493,8 +493,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n367_curly_clone_incubator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_ref(&players);
|
||||
|
||||
|
@ -525,8 +524,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n368_gclone(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -750,11 +748,10 @@ impl NPC {
|
|||
pub(crate) fn tick_n369_gclone_curly_clone(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
// action_counter3 is used to keep track of grabbed player
|
||||
let mut player = self.get_closest_player_mut(players);
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
match self.action_num {
|
||||
0 | 1 | 10 => {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
use crate::common::{CDEG_RAD, Direction, Rect};
|
||||
use crate::common::{Direction, Rect, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::physics::HitExtents;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n108_balfrog_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n108_balfrog_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_counter > 300 || (self.flags.0 & 0xff) != 0 {
|
||||
self.cond.set_alive(false);
|
||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
||||
|
@ -32,8 +32,7 @@ impl BossNPC {
|
|||
pub(crate) fn tick_b02_balfrog(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
BossNPCContext { players, npc_list, .. }: BossNPCContext,
|
||||
) {
|
||||
match self.parts[0].action_num {
|
||||
0 => {
|
||||
|
@ -43,7 +42,8 @@ impl BossNPC {
|
|||
self.parts[0].direction = Direction::Right;
|
||||
self.parts[0].display_bounds =
|
||||
Rect { left: 48 * 0x200, top: 48 * 0x200, right: 32 * 0x200, bottom: 0x2000 };
|
||||
self.parts[0].hit_bounds = HitExtents { left: 24 * 0x200, top: 0x2000, right: 24 * 0x200, bottom: 0x2000 };
|
||||
self.parts[0].hit_bounds =
|
||||
HitExtents { left: 24 * 0x200, top: 0x2000, right: 24 * 0x200, bottom: 0x2000 };
|
||||
self.parts[0].size = 3;
|
||||
self.parts[0].exp = 1;
|
||||
self.parts[0].event_num = 1000;
|
||||
|
@ -484,7 +484,8 @@ impl BossNPC {
|
|||
self.hurt_sound[2] = 52;
|
||||
self.parts[2].size = 3;
|
||||
self.parts[2].npc_flags.set_invulnerable(true);
|
||||
self.parts[2].hit_bounds = HitExtents { left: 24 * 0x200, top: 0x2000, right: 24 * 0x200, bottom: 0x2000 };
|
||||
self.parts[2].hit_bounds =
|
||||
HitExtents { left: 24 * 0x200, top: 0x2000, right: 24 * 0x200, bottom: 0x2000 };
|
||||
}
|
||||
1 => {
|
||||
self.parts[1].x = self.parts[0].x + self.parts[0].direction.vector_x() * 24 * 0x200;
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
use crate::common::{Direction, Rect, CDEG_RAD};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::physics::HitExtents;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n331_ballos_bone_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n331_ballos_bone_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
self.action_num = 1;
|
||||
|
@ -54,7 +57,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n332_ballos_shockwave(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n332_ballos_shockwave(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -94,8 +101,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n333_ballos_lightning(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -129,7 +135,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n338_green_devil(&mut self, state: &mut SharedGameState, stage: &mut Stage) -> GameResult {
|
||||
pub(crate) fn tick_n338_green_devil(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -172,7 +182,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n339_green_devil_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -202,9 +212,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n340_ballos(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
flash: &mut Flash,
|
||||
NPCContext { players, npc_list, flash, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -584,7 +592,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n341_ballos_1_head(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||
pub(crate) fn tick_n341_ballos_1_head(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if let Some(parent) = self.get_parent_ref_mut(npc_list) {
|
||||
if parent.action_num == 11 && parent.action_counter > 50 {
|
||||
self.anim_counter += 1;
|
||||
|
@ -610,9 +622,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n342_ballos_orbiting_eye(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
boss: &mut BossNPC,
|
||||
NPCContext { players, npc_list, boss, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num < 1000 && boss.parts[0].action_num >= 1000 {
|
||||
self.action_num = 1000;
|
||||
|
@ -904,7 +914,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n343_ballos_3_cutscene(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
boss: &mut BossNPC,
|
||||
NPCContext { boss, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
self.action_counter += 1;
|
||||
if self.action_counter > 100 {
|
||||
|
@ -919,7 +929,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n344_ballos_3_eyes(&mut self, state: &mut SharedGameState, boss: &mut BossNPC) -> GameResult {
|
||||
pub(crate) fn tick_n344_ballos_3_eyes(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
NPCContext { boss, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
self.action_counter += 1;
|
||||
if self.action_counter > 100 {
|
||||
self.cond.set_alive(false);
|
||||
|
@ -936,8 +950,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n345_ballos_skull_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 100 => {
|
||||
|
@ -1005,9 +1018,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n346_ballos_orbiting_platform(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
stage: &mut Stage,
|
||||
boss: &mut BossNPC,
|
||||
NPCContext { players, stage, boss, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num < 1000 && boss.parts[0].action_num >= 1000 {
|
||||
self.action_num = 1000;
|
||||
|
@ -1139,7 +1150,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n348_ballos_4_spikes(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n348_ballos_4_spikes(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
self.action_num = 1;
|
||||
|
@ -1165,9 +1176,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n350_flying_bute_archer(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { players, npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -1288,7 +1297,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n353_bute_sword_flying(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
let player = self.get_closest_player_mut(players);
|
||||
|
||||
|
@ -1366,8 +1375,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n354_invisible_deathtrap_wall(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -1416,9 +1424,7 @@ impl BossNPC {
|
|||
pub(crate) fn tick_b09_ballos(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
flash: &mut Flash,
|
||||
BossNPCContext { players, npc_list, flash, .. }: BossNPCContext,
|
||||
) {
|
||||
let player = self.parts[0].get_closest_player_mut(players);
|
||||
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
use crate::common::{CDEG_RAD, Direction};
|
||||
use crate::common::{Direction, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::player::Player;
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n178_core_blade_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n178_core_blade_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.flags.hit_anything() {
|
||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
||||
self.cond.set_alive(false);
|
||||
|
@ -37,7 +39,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n179_core_wisp_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n179_core_wisp_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.flags.hit_anything() {
|
||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
||||
self.cond.set_alive(false);
|
||||
|
@ -66,7 +68,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n218_core_giant_ball(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n218_core_giant_ball(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.x += self.vel_x;
|
||||
self.y += self.vel_y;
|
||||
|
||||
|
@ -86,14 +88,12 @@ impl BossNPC {
|
|||
pub(crate) fn tick_b04_core(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
mut players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
BossNPCContext { mut players, npc_list, stage, .. }: BossNPCContext,
|
||||
) {
|
||||
let mut flag = false;
|
||||
// i will refactor that one day
|
||||
#[allow(mutable_transmutes)]
|
||||
let flash_counter: &mut u16 = unsafe { std::mem::transmute(&self.parts[19].action_counter3) };
|
||||
let flash_counter: &mut u16 = unsafe { std::mem::transmute(&self.parts[19].action_counter3) };
|
||||
|
||||
match self.parts[0].action_num {
|
||||
0 => {
|
||||
|
@ -180,7 +180,7 @@ impl BossNPC {
|
|||
self.parts[7].x = self.parts[0].x - 0x6000;
|
||||
self.parts[7].y = self.parts[0].y + 0x4000;
|
||||
|
||||
for i in [2,3,6,7] {
|
||||
for i in [2, 3, 6, 7] {
|
||||
self.hurt_sound[i] = 54;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
use crate::common::{Direction, Rect};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::physics::HitExtents;
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n325_heavy_press_lightning(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -53,7 +53,11 @@ impl NPC {
|
|||
}
|
||||
|
||||
impl BossNPC {
|
||||
pub(crate) fn tick_b08_heavy_press(&mut self, state: &mut SharedGameState, npc_list: &NPCList, stage: &mut Stage) {
|
||||
pub(crate) fn tick_b08_heavy_press(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
BossNPCContext { npc_list, stage, .. }: BossNPCContext,
|
||||
) {
|
||||
match self.parts[0].action_num {
|
||||
0 => {
|
||||
self.parts[0].action_num = 10;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
use crate::common::{Direction, Rect};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::physics::HitExtents;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n196_ironhead_wall(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n196_ironhead_wall(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
self.x -= 0xC00;
|
||||
if self.x <= if !state.constants.is_switch { 0x26000 } else { 0x1E000 } {
|
||||
self.x += if !state.constants.is_switch { 0x2C000 } else { 0x3B400 };
|
||||
|
@ -22,7 +22,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n197_porcupine_fish(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n197_porcupine_fish(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 10 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -66,7 +66,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n198_ironhead_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n198_ironhead_projectile(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_counter += 1;
|
||||
if self.action_counter > 20 {
|
||||
|
@ -97,7 +97,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n335_ikachan(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n335_ikachan(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
if self.action_num == 0 {
|
||||
|
@ -146,8 +146,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n336_ikachan_generator(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
NPCContext { players, npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 => {
|
||||
|
@ -178,8 +177,7 @@ impl BossNPC {
|
|||
pub(crate) fn tick_b05_ironhead(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
BossNPCContext { players, npc_list, .. }: BossNPCContext,
|
||||
) {
|
||||
match self.parts[0].action_num {
|
||||
0 => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::mem::{MaybeUninit, transmute};
|
||||
use std::mem::{transmute, MaybeUninit};
|
||||
use std::ops::Deref;
|
||||
|
||||
use crate::common::{Direction, interpolate_fix9_scale};
|
||||
use crate::common::{interpolate_fix9_scale, Direction};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::entity::GameEntity;
|
||||
use crate::framework::context::Context;
|
||||
|
@ -68,18 +68,16 @@ impl BossNPC {
|
|||
}
|
||||
}
|
||||
|
||||
impl GameEntity<([&mut Player; 2], &NPCList, &mut Stage, &BulletManager, &mut Flash)> for BossNPC {
|
||||
fn tick(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
(players, npc_list, stage, bullet_manager, flash): (
|
||||
[&mut Player; 2],
|
||||
&NPCList,
|
||||
&mut Stage,
|
||||
&BulletManager,
|
||||
&mut Flash,
|
||||
),
|
||||
) -> GameResult {
|
||||
pub struct BossNPCContext<'a> {
|
||||
pub players: [&'a mut Player; 2],
|
||||
pub npc_list: &'a NPCList,
|
||||
pub stage: &'a mut Stage,
|
||||
pub bullet_manager: &'a mut BulletManager,
|
||||
pub flash: &'a mut Flash,
|
||||
}
|
||||
|
||||
impl GameEntity<BossNPCContext<'_>> for BossNPC {
|
||||
fn tick(&mut self, state: &mut SharedGameState, boss_ctx: BossNPCContext) -> GameResult {
|
||||
if !self.parts[0].cond.alive() {
|
||||
// Kind of hacky but fixes Monster X's damage popup being stuck on screen
|
||||
self.parts[0].popup.tick(state, ())?;
|
||||
|
@ -87,15 +85,15 @@ impl GameEntity<([&mut Player; 2], &NPCList, &mut Stage, &BulletManager, &mut Fl
|
|||
}
|
||||
|
||||
match self.boss_type {
|
||||
1 => self.tick_b01_omega(state, players, npc_list, bullet_manager, flash),
|
||||
2 => self.tick_b02_balfrog(state, players, npc_list),
|
||||
3 => self.tick_b03_monster_x(state, players, npc_list, flash),
|
||||
4 => self.tick_b04_core(state, players, npc_list, stage),
|
||||
5 => self.tick_b05_ironhead(state, players, npc_list),
|
||||
6 => self.tick_b06_sisters(state, players, npc_list, flash),
|
||||
7 => self.tick_b07_undead_core(state, npc_list, stage, flash),
|
||||
8 => self.tick_b08_heavy_press(state, npc_list, stage),
|
||||
9 => self.tick_b09_ballos(state, players, npc_list, flash),
|
||||
1 => self.tick_b01_omega(state, boss_ctx),
|
||||
2 => self.tick_b02_balfrog(state, boss_ctx),
|
||||
3 => self.tick_b03_monster_x(state, boss_ctx),
|
||||
4 => self.tick_b04_core(state, boss_ctx),
|
||||
5 => self.tick_b05_ironhead(state, boss_ctx),
|
||||
6 => self.tick_b06_sisters(state, boss_ctx),
|
||||
7 => self.tick_b07_undead_core(state, boss_ctx),
|
||||
8 => self.tick_b08_heavy_press(state, boss_ctx),
|
||||
9 => self.tick_b09_ballos(state, boss_ctx),
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
use num_traits::{abs, clamp};
|
||||
|
||||
use crate::common::{Direction, Rect, CDEG_RAD};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::physics::HitExtents;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n158_fish_missile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -78,7 +79,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n159_monster_x_defeated(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -139,9 +140,7 @@ impl BossNPC {
|
|||
pub(crate) fn tick_b03_monster_x(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
flash: &mut Flash,
|
||||
BossNPCContext { players, npc_list, flash, .. }: BossNPCContext,
|
||||
) {
|
||||
match self.parts[0].action_num {
|
||||
0 => {
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
use crate::common::{Direction, Rect};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::caret::CaretType;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::physics::HitExtents;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::weapon::bullet::BulletManager;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n048_omega_projectiles(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n048_omega_projectiles(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if (self.flags.hit_left_wall() && self.vel_x < 0) || (self.flags.hit_right_wall() && self.vel_x > 0) {
|
||||
self.vel_x = -self.vel_x;
|
||||
} else if self.flags.hit_bottom_wall() {
|
||||
|
@ -54,10 +52,7 @@ impl BossNPC {
|
|||
pub(crate) fn tick_b01_omega(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
bullet_manager: &BulletManager,
|
||||
flash: &mut Flash,
|
||||
BossNPCContext { players, npc_list, bullet_manager, flash, .. }: BossNPCContext,
|
||||
) {
|
||||
match self.parts[0].action_num {
|
||||
0 => {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use crate::common::{Direction, Rect, SliceExt, CDEG_RAD};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
|
@ -8,13 +7,13 @@ use crate::game::player::Player;
|
|||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl BossNPC {
|
||||
pub(crate) fn tick_b06_sisters(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
flash: &mut Flash,
|
||||
BossNPCContext { players, npc_list, flash, .. }: BossNPCContext,
|
||||
) {
|
||||
match self.parts[0].action_num {
|
||||
0 => {
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
use std::hint::unreachable_unchecked;
|
||||
|
||||
use crate::common::{CDEG_RAD, Direction, Rect, SliceExt};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::common::{Direction, Rect, SliceExt, CDEG_RAD};
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::Player;
|
||||
use crate::game::npc::{NPCContext, NPC};
|
||||
use crate::game::shared_game_state::SharedGameState;
|
||||
use crate::game::stage::Stage;
|
||||
use crate::util::rng::RNG;
|
||||
|
||||
use super::BossNPCContext;
|
||||
|
||||
impl NPC {
|
||||
pub(crate) fn tick_n282_mini_undead_core_active(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
NPCContext { players, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 20;
|
||||
|
@ -93,7 +93,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n291_mini_undead_core_inactive(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n291_mini_undead_core_inactive(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 20;
|
||||
if self.direction == Direction::Right {
|
||||
|
@ -110,7 +114,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n293_undead_core_energy_shot(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
NPCContext { npc_list, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.action_num = 1;
|
||||
|
@ -143,8 +147,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n285_undead_core_spiral_projectile(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
if self.x < 0 || self.x > stage.map.width as i32 * state.tile_size.as_int() * 0x200 {
|
||||
self.vanish(state);
|
||||
|
@ -186,7 +189,11 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n286_undead_core_spiral_projectile_trail(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n286_undead_core_spiral_projectile_trail(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
_: NPCContext,
|
||||
) -> GameResult {
|
||||
self.anim_counter += 1;
|
||||
if self.anim_counter > 0 {
|
||||
self.anim_counter = 0;
|
||||
|
@ -202,7 +209,7 @@ impl NPC {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn tick_n287_orange_smoke(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
pub(crate) fn tick_n287_orange_smoke(&mut self, state: &mut SharedGameState, _: NPCContext) -> GameResult {
|
||||
if self.action_num == 0 {
|
||||
self.vel_x = self.rng.range(-4..4) * 0x200;
|
||||
self.action_num = 1;
|
||||
|
@ -231,9 +238,7 @@ impl NPC {
|
|||
pub(crate) fn tick_n288_undead_core_exploding_rock(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
players: [&mut Player; 2],
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
NPCContext { players, npc_list, stage, .. }: NPCContext,
|
||||
) -> GameResult {
|
||||
match self.action_num {
|
||||
0 | 1 => {
|
||||
|
@ -317,9 +322,7 @@ impl BossNPC {
|
|||
pub(crate) fn tick_b07_undead_core(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
npc_list: &NPCList,
|
||||
stage: &mut Stage,
|
||||
flash: &mut Flash,
|
||||
BossNPCContext { npc_list, stage, flash, .. }: BossNPCContext,
|
||||
) {
|
||||
let mut v19 = false;
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ use std::io::Cursor;
|
|||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
|
||||
use byteorder::{LE, ReadBytesExt};
|
||||
use byteorder::{ReadBytesExt, LE};
|
||||
|
||||
use crate::bitfield;
|
||||
use crate::common::{Condition, interpolate_fix9_scale, Rect};
|
||||
use crate::common::Direction;
|
||||
use crate::common::Flag;
|
||||
use crate::common::{interpolate_fix9_scale, Condition, Rect};
|
||||
use crate::components::flash::Flash;
|
||||
use crate::components::number_popup::NumberPopup;
|
||||
use crate::entity::GameEntity;
|
||||
|
@ -231,395 +231,389 @@ impl NPC {
|
|||
}
|
||||
}
|
||||
|
||||
impl GameEntity<([&mut Player; 2], &NPCList, &mut Stage, &mut BulletManager, &mut Flash, &mut BossNPC)> for NPC {
|
||||
fn tick(
|
||||
&mut self,
|
||||
state: &mut SharedGameState,
|
||||
(players, npc_list, stage, bullet_manager, flash, boss): (
|
||||
[&mut Player; 2],
|
||||
&NPCList,
|
||||
&mut Stage,
|
||||
&mut BulletManager,
|
||||
&mut Flash,
|
||||
&mut BossNPC,
|
||||
),
|
||||
) -> GameResult {
|
||||
#[allow(unused_mut, unused_assignments)]
|
||||
let mut npc_hook_ran = false;
|
||||
pub struct NPCContext<'a> {
|
||||
pub players: [&'a mut Player; 2],
|
||||
pub npc_list: &'a NPCList,
|
||||
pub stage: &'a mut Stage,
|
||||
pub bullet_manager: &'a mut BulletManager,
|
||||
pub flash: &'a mut Flash,
|
||||
pub boss: &'a mut BossNPC,
|
||||
}
|
||||
|
||||
impl GameEntity<NPCContext<'_>> for NPC {
|
||||
fn tick(&mut self, state: &mut SharedGameState, ctx: NPCContext) -> GameResult {
|
||||
match self.npc_type {
|
||||
_ if npc_hook_ran => Ok(()),
|
||||
0 => self.tick_n000_null(),
|
||||
1 => self.tick_n001_experience(state, stage),
|
||||
2 => self.tick_n002_behemoth(state, npc_list),
|
||||
3 => self.tick_n003_dead_enemy(),
|
||||
4 => self.tick_n004_smoke(state),
|
||||
5 => self.tick_n005_green_critter(state, players),
|
||||
6 => self.tick_n006_green_beetle(state),
|
||||
7 => self.tick_n007_basil(state, players),
|
||||
8 => self.tick_n008_blue_beetle(state, players),
|
||||
9 => self.tick_n009_balrog_falling_in(state, npc_list),
|
||||
10 => self.tick_n010_balrog_shooting(state, players, npc_list),
|
||||
11 => self.tick_n011_balrogs_projectile(state),
|
||||
12 => self.tick_n012_balrog_cutscene(state, players, npc_list, stage),
|
||||
13 => self.tick_n013_forcefield(state),
|
||||
14 => self.tick_n014_key(state, npc_list),
|
||||
15 => self.tick_n015_chest_closed(state, npc_list),
|
||||
16 => self.tick_n016_save_point(state, npc_list),
|
||||
17 => self.tick_n017_health_refill(state, npc_list),
|
||||
18 => self.tick_n018_door(state, npc_list),
|
||||
19 => self.tick_n019_balrog_bust_in(state, npc_list),
|
||||
20 => self.tick_n020_computer(state),
|
||||
21 => self.tick_n021_chest_open(state),
|
||||
22 => self.tick_n022_teleporter(state),
|
||||
23 => self.tick_n023_teleporter_lights(state),
|
||||
24 => self.tick_n024_power_critter(state, players),
|
||||
25 => self.tick_n025_lift(state),
|
||||
26 => self.tick_n026_bat_flying(state, players),
|
||||
27 => self.tick_n027_death_trap(state),
|
||||
28 => self.tick_n028_flying_critter(state, players),
|
||||
29 => self.tick_n029_cthulhu(state, players),
|
||||
30 => self.tick_n030_gunsmith(state),
|
||||
31 => self.tick_n031_bat_hanging(state, players),
|
||||
32 => self.tick_n032_life_capsule(state),
|
||||
33 => self.tick_n033_balrog_bouncing_projectile(state),
|
||||
34 => self.tick_n034_bed(state),
|
||||
35 => self.tick_n035_mannan(state, npc_list),
|
||||
36 => self.tick_n036_balrog_hover(state, players, npc_list),
|
||||
37 => self.tick_n037_sign(state),
|
||||
38 => self.tick_n038_fireplace(state, npc_list),
|
||||
39 => self.tick_n039_save_sign(state),
|
||||
40 => self.tick_n040_santa(state, players),
|
||||
41 => self.tick_n041_busted_door(state),
|
||||
42 => self.tick_n042_sue(state, players, npc_list),
|
||||
43 => self.tick_n043_chalkboard(state),
|
||||
44 => self.tick_n044_polish(state, npc_list),
|
||||
45 => self.tick_n045_baby(state),
|
||||
46 => self.tick_n046_hv_trigger(state, players),
|
||||
47 => self.tick_n047_sandcroc(state, players),
|
||||
48 => self.tick_n048_omega_projectiles(state),
|
||||
49 => self.tick_n049_skullhead(state, players, npc_list),
|
||||
50 => self.tick_n050_skeleton_projectile(state),
|
||||
51 => self.tick_n051_crow_and_skullhead(state, players, npc_list),
|
||||
52 => self.tick_n052_sitting_blue_robot(state),
|
||||
53 => self.tick_n053_skullstep_leg(state, npc_list),
|
||||
54 => self.tick_n054_skullstep(state, npc_list),
|
||||
55 => self.tick_n055_kazuma(state),
|
||||
56 => self.tick_n056_tan_beetle(state, players),
|
||||
57 => self.tick_n057_crow(state, players),
|
||||
58 => self.tick_n058_basu(state, players, npc_list),
|
||||
59 => self.tick_n059_eye_door(state, players),
|
||||
60 => self.tick_n060_toroko(state, players),
|
||||
61 => self.tick_n061_king(state, npc_list),
|
||||
62 => self.tick_n062_kazuma_computer(state),
|
||||
63 => self.tick_n063_toroko_stick(state),
|
||||
64 => self.tick_n064_first_cave_critter(state, players),
|
||||
65 => self.tick_n065_first_cave_bat(state, players),
|
||||
66 => self.tick_n066_misery_bubble(state, npc_list),
|
||||
67 => self.tick_n067_misery_floating(state, npc_list, flash),
|
||||
68 => self.tick_n068_balrog_running(state, players, npc_list),
|
||||
69 => self.tick_n069_pignon(state),
|
||||
70 => self.tick_n070_sparkle(state),
|
||||
71 => self.tick_n071_chinfish(state),
|
||||
72 => self.tick_n072_sprinkler(state, players, npc_list),
|
||||
73 => self.tick_n073_water_droplet(state, stage),
|
||||
74 => self.tick_n074_jack(state),
|
||||
75 => self.tick_n075_kanpachi(state, players),
|
||||
76 => self.tick_n076_flowers(),
|
||||
77 => self.tick_n077_yamashita(state),
|
||||
78 => self.tick_n078_pot(state),
|
||||
79 => self.tick_n079_mahin(state, players),
|
||||
80 => self.tick_n080_gravekeeper(state, players),
|
||||
81 => self.tick_n081_giant_pignon(state, players),
|
||||
82 => self.tick_n082_misery_standing(state, npc_list, flash),
|
||||
83 => self.tick_n083_igor_cutscene(state),
|
||||
84 => self.tick_n084_basu_projectile(state),
|
||||
85 => self.tick_n085_terminal(state, players),
|
||||
86 => self.tick_n086_missile_pickup(state, stage),
|
||||
87 => self.tick_n087_heart_pickup(state, stage),
|
||||
88 => self.tick_n088_igor_boss(state, players, npc_list),
|
||||
89 => self.tick_n089_igor_dead(state, players, npc_list),
|
||||
90 => self.tick_n090_background(state),
|
||||
91 => self.tick_n091_mimiga_cage(state),
|
||||
92 => self.tick_n092_sue_at_pc(state),
|
||||
93 => self.tick_n093_chaco(state, players),
|
||||
94 => self.tick_n094_kulala(state, players),
|
||||
95 => self.tick_n095_jelly(state),
|
||||
96 => self.tick_n096_fan_left(state, players, npc_list),
|
||||
97 => self.tick_n097_fan_up(state, players, npc_list),
|
||||
98 => self.tick_n098_fan_right(state, players, npc_list),
|
||||
99 => self.tick_n099_fan_down(state, players, npc_list),
|
||||
100 => self.tick_n100_grate(state),
|
||||
101 => self.tick_n101_malco_screen(state),
|
||||
102 => self.tick_n102_malco_computer_wave(state),
|
||||
103 => self.tick_n103_mannan_projectile(state),
|
||||
104 => self.tick_n104_frog(state, players),
|
||||
105 => self.tick_n105_hey_bubble_low(state),
|
||||
106 => self.tick_n106_hey_bubble_high(state, npc_list),
|
||||
107 => self.tick_n107_malco_broken(state, npc_list),
|
||||
108 => self.tick_n108_balfrog_projectile(state),
|
||||
109 => self.tick_n109_malco_powered_on(state, players, npc_list),
|
||||
110 => self.tick_n110_puchi(state, players),
|
||||
111 => self.tick_n111_quote_teleport_out(state, players),
|
||||
112 => self.tick_n112_quote_teleport_in(state, players),
|
||||
113 => self.tick_n113_professor_booster(state),
|
||||
114 => self.tick_n114_press(state, players, npc_list),
|
||||
115 => self.tick_n115_ravil(state, players, npc_list),
|
||||
116 => self.tick_n116_red_petals(state),
|
||||
117 => self.tick_n117_curly(state, players, npc_list),
|
||||
118 => self.tick_n118_curly_boss(state, players, npc_list, bullet_manager),
|
||||
119 => self.tick_n119_table_chair(state),
|
||||
120 => self.tick_n120_colon_a(state),
|
||||
121 => self.tick_n121_colon_b(state),
|
||||
122 => self.tick_n122_colon_enraged(state, players),
|
||||
123 => self.tick_n123_curly_boss_bullet(state),
|
||||
124 => self.tick_n124_sunstone(state),
|
||||
125 => self.tick_n125_hidden_item(state, npc_list),
|
||||
126 => self.tick_n126_puppy_running(state, players),
|
||||
127 => self.tick_n127_machine_gun_trail_l2(state),
|
||||
128 => self.tick_n128_machine_gun_trail_l3(state),
|
||||
129 => self.tick_n129_fireball_snake_trail(state),
|
||||
130 => self.tick_n130_puppy_sitting(state, players),
|
||||
131 => self.tick_n131_puppy_sleeping(state),
|
||||
132 => self.tick_n132_puppy_barking(state, players),
|
||||
133 => self.tick_n133_jenka(state),
|
||||
134 => self.tick_n134_armadillo(state, players, bullet_manager),
|
||||
135 => self.tick_n135_skeleton(state, players, npc_list),
|
||||
136 => self.tick_n136_puppy_carried(state, players),
|
||||
137 => self.tick_n137_large_door_frame(state),
|
||||
138 => self.tick_n138_large_door(state),
|
||||
139 => self.tick_n139_doctor(state),
|
||||
140 => self.tick_n140_toroko_frenzied(state, players, npc_list, bullet_manager),
|
||||
141 => self.tick_n141_toroko_block_projectile(state, players, npc_list),
|
||||
142 => self.tick_n142_flower_cub(state, players),
|
||||
143 => self.tick_n143_jenka_collapsed(state),
|
||||
144 => self.tick_n144_toroko_teleporting_in(state),
|
||||
145 => self.tick_n145_king_sword(state, npc_list),
|
||||
146 => self.tick_n146_lightning(state, npc_list, flash),
|
||||
147 => self.tick_n147_critter_purple(state, players, npc_list),
|
||||
148 => self.tick_n148_critter_purple_projectile(state),
|
||||
149 => self.tick_n149_horizontal_moving_block(state, players, npc_list),
|
||||
150 => self.tick_n150_quote(state, players, npc_list),
|
||||
151 => self.tick_n151_blue_robot_standing(state),
|
||||
152 => self.tick_n152_shutter_stuck(),
|
||||
153 => self.tick_n153_gaudi(state, players),
|
||||
154 => self.tick_n154_gaudi_dead(state),
|
||||
155 => self.tick_n155_gaudi_flying(state, players, npc_list),
|
||||
156 => self.tick_n156_gaudi_projectile(state),
|
||||
157 => self.tick_n157_vertical_moving_block(state, players, npc_list),
|
||||
158 => self.tick_n158_fish_missile(state, players),
|
||||
159 => self.tick_n159_monster_x_defeated(state, npc_list),
|
||||
160 => self.tick_n160_puu_black(state, players, npc_list),
|
||||
161 => self.tick_n161_puu_black_projectile(state),
|
||||
162 => self.tick_n162_puu_black_dead(state, players, npc_list),
|
||||
163 => self.tick_n163_dr_gero(state),
|
||||
164 => self.tick_n164_nurse_hasumi(state),
|
||||
165 => self.tick_n165_curly_collapsed(state, players),
|
||||
166 => self.tick_n166_chaba(state),
|
||||
167 => self.tick_n167_booster_falling(state, npc_list),
|
||||
168 => self.tick_n168_boulder(state),
|
||||
169 => self.tick_n169_balrog_shooting_missiles(state, players, npc_list),
|
||||
170 => self.tick_n170_balrog_missile(state, players, npc_list),
|
||||
171 => self.tick_n171_fire_whirrr(state, players, npc_list),
|
||||
172 => self.tick_n172_fire_whirrr_projectile(state),
|
||||
173 => self.tick_n173_gaudi_armored(state, players, npc_list),
|
||||
174 => self.tick_n174_gaudi_armored_projectile(state),
|
||||
175 => self.tick_n175_gaudi_egg(state),
|
||||
176 => self.tick_n176_buyo_buyo_base(state, players, npc_list),
|
||||
177 => self.tick_n177_buyo_buyo(state, players),
|
||||
178 => self.tick_n178_core_blade_projectile(state),
|
||||
179 => self.tick_n179_core_wisp_projectile(state),
|
||||
180 => self.tick_n180_curly_ai(state, players, npc_list),
|
||||
181 => self.tick_n181_curly_ai_machine_gun(state, npc_list, bullet_manager),
|
||||
182 => self.tick_n182_curly_ai_polar_star(state, npc_list, bullet_manager),
|
||||
183 => self.tick_n183_curly_air_tank_bubble(state, npc_list),
|
||||
184 => self.tick_n184_shutter(state, npc_list),
|
||||
185 => self.tick_n185_small_shutter(state),
|
||||
186 => self.tick_n186_lift_block(state),
|
||||
187 => self.tick_n187_fuzz_core(state, players, npc_list),
|
||||
188 => self.tick_n188_fuzz(state, players, npc_list),
|
||||
189 => self.tick_n189_homing_flame(state, players),
|
||||
190 => self.tick_n190_broken_robot(state, npc_list),
|
||||
191 => self.tick_n191_water_level(state),
|
||||
192 => self.tick_n192_scooter(state),
|
||||
193 => self.tick_n193_broken_scooter(state),
|
||||
194 => self.tick_n194_broken_blue_robot(state),
|
||||
195 => self.tick_n195_background_grate(state),
|
||||
196 => self.tick_n196_ironhead_wall(state),
|
||||
197 => self.tick_n197_porcupine_fish(state),
|
||||
198 => self.tick_n198_ironhead_projectile(state),
|
||||
199 => self.tick_n199_wind_particles(state),
|
||||
200 => self.tick_n200_zombie_dragon(state, players, npc_list),
|
||||
201 => self.tick_n201_zombie_dragon_dead(state),
|
||||
202 => self.tick_n202_zombie_dragon_projectile(state),
|
||||
203 => self.tick_n203_critter_destroyed_egg_corridor(state, players),
|
||||
204 => self.tick_n204_small_falling_spike(state, players, npc_list),
|
||||
205 => self.tick_n205_large_falling_spike(state, players, npc_list, bullet_manager),
|
||||
206 => self.tick_n206_counter_bomb(state, players, npc_list),
|
||||
207 => self.tick_n207_counter_bomb_countdown(state),
|
||||
208 => self.tick_n208_basu_destroyed_egg_corridor(state, players, npc_list),
|
||||
209 => self.tick_n209_basu_projectile_destroyed_egg_corridor(state),
|
||||
210 => self.tick_n210_beetle_destroyed_egg_corridor(state, players),
|
||||
211 => self.tick_n211_small_spikes(state),
|
||||
212 => self.tick_n212_sky_dragon(state, players, npc_list),
|
||||
213 => self.tick_n213_night_spirit(state, players, npc_list),
|
||||
214 => self.tick_n214_night_spirit_projectile(state, npc_list),
|
||||
215 => self.tick_n215_sandcroc_outer_wall(state, players),
|
||||
216 => self.tick_n216_debug_cat(state),
|
||||
217 => self.tick_n217_itoh(state),
|
||||
218 => self.tick_n218_core_giant_ball(state),
|
||||
219 => self.tick_n219_smoke_generator(state, npc_list),
|
||||
220 => self.tick_n220_shovel_brigade(state),
|
||||
221 => self.tick_n221_shovel_brigade_walking(state),
|
||||
222 => self.tick_n222_prison_bars(state),
|
||||
223 => self.tick_n223_momorin(state, players),
|
||||
224 => self.tick_n224_chie(state, players),
|
||||
225 => self.tick_n225_megane(state),
|
||||
226 => self.tick_n226_kanpachi_plantation(state),
|
||||
227 => self.tick_n227_bucket(state),
|
||||
228 => self.tick_n228_droll(state, players),
|
||||
229 => self.tick_n229_red_flowers_sprouts(state),
|
||||
230 => self.tick_n230_red_flowers_blooming(state),
|
||||
231 => self.tick_n231_rocket(state, players, npc_list),
|
||||
232 => self.tick_n232_orangebell(state, npc_list),
|
||||
233 => self.tick_n233_orangebell_bat(state, players, npc_list),
|
||||
234 => self.tick_n234_red_flowers_picked(state),
|
||||
235 => self.tick_n235_midorin(state),
|
||||
236 => self.tick_n236_gunfish(state, players, npc_list),
|
||||
237 => self.tick_n237_gunfish_projectile(state),
|
||||
238 => self.tick_n238_press_sideways(state, players, npc_list),
|
||||
239 => self.tick_n239_cage_bars(state),
|
||||
240 => self.tick_n240_mimiga_jailed(state),
|
||||
241 => self.tick_n241_critter_red(state, players),
|
||||
242 => self.tick_n242_bat_last_cave(state, stage),
|
||||
243 => self.tick_n243_bat_generator(state, npc_list),
|
||||
244 => self.tick_n244_lava_drop(state, players),
|
||||
245 => self.tick_n245_lava_drop_generator(state, npc_list),
|
||||
246 => self.tick_n246_press_proximity(state, players, npc_list),
|
||||
247 => self.tick_n247_misery_boss(state, players, npc_list),
|
||||
248 => self.tick_n248_misery_boss_vanishing(state),
|
||||
249 => self.tick_n249_misery_boss_appearing(state),
|
||||
250 => self.tick_n250_misery_boss_lightning_ball(state, players, npc_list),
|
||||
251 => self.tick_n251_misery_boss_lightning(state, npc_list),
|
||||
252 => self.tick_n252_misery_boss_bats(state, players, npc_list),
|
||||
253 => self.tick_n253_experience_capsule(state, npc_list),
|
||||
254 => self.tick_n254_helicopter(state, npc_list),
|
||||
255 => self.tick_n255_helicopter_blades(state, npc_list),
|
||||
256 => self.tick_n256_doctor_facing_away(state, npc_list),
|
||||
257 => self.tick_n257_red_crystal(state),
|
||||
258 => self.tick_n258_mimiga_sleeping(state),
|
||||
259 => self.tick_n259_curly_unconscious(state, players, npc_list),
|
||||
260 => self.tick_n260_shovel_brigade_caged(state, players, npc_list),
|
||||
261 => self.tick_n261_chie_caged(state, players),
|
||||
262 => self.tick_n262_chaco_caged(state, players),
|
||||
263 => self.tick_n263_doctor_boss(state, players, npc_list),
|
||||
264 => self.tick_n264_doctor_boss_red_projectile(state, npc_list, stage),
|
||||
265 => self.tick_n265_doctor_boss_red_projectile_trail(state),
|
||||
266 => self.tick_n266_doctor_boss_red_projectile_bouncing(state, npc_list),
|
||||
267 => self.tick_n267_muscle_doctor(state, players, npc_list),
|
||||
268 => self.tick_n268_igor_enemy(state, players, npc_list),
|
||||
269 => self.tick_n269_red_bat_bouncing(state),
|
||||
270 => self.tick_n270_doctor_red_energy(state, npc_list),
|
||||
271 => self.tick_n271_ironhead_block(state, stage),
|
||||
272 => self.tick_n272_ironhead_block_generator(state, npc_list),
|
||||
273 => self.tick_n273_droll_projectile(state, npc_list),
|
||||
274 => self.tick_n274_droll(state, players, npc_list),
|
||||
275 => self.tick_n275_puppy_plantation(state, players),
|
||||
276 => self.tick_n276_red_demon(state, players, npc_list),
|
||||
277 => self.tick_n277_red_demon_projectile(state, npc_list),
|
||||
278 => self.tick_n278_little_family(state),
|
||||
279 => self.tick_n279_large_falling_block(state, players, npc_list, stage),
|
||||
280 => self.tick_n280_sue_teleported(state),
|
||||
281 => self.tick_n281_doctor_energy_form(state, npc_list),
|
||||
282 => self.tick_n282_mini_undead_core_active(state, players),
|
||||
283 => self.tick_n283_misery_possessed(state, players, npc_list, stage, boss),
|
||||
284 => self.tick_n284_sue_possessed(state, players, npc_list, stage, boss),
|
||||
285 => self.tick_n285_undead_core_spiral_projectile(state, npc_list, stage),
|
||||
286 => self.tick_n286_undead_core_spiral_projectile_trail(state),
|
||||
287 => self.tick_n287_orange_smoke(state),
|
||||
288 => self.tick_n288_undead_core_exploding_rock(state, players, npc_list, stage),
|
||||
289 => self.tick_n289_critter_orange(state, players, stage),
|
||||
290 => self.tick_n290_bat_misery(state, players, stage),
|
||||
291 => self.tick_n291_mini_undead_core_inactive(state),
|
||||
292 => self.tick_n292_quake(state),
|
||||
293 => self.tick_n293_undead_core_energy_shot(state, npc_list),
|
||||
294 => self.tick_n294_quake_falling_block_generator(state, players, npc_list, stage),
|
||||
295 => self.tick_n295_cloud(state),
|
||||
296 => self.tick_n296_cloud_generator(state, npc_list),
|
||||
297 => self.tick_n297_sue_dragon_mouth(state, npc_list),
|
||||
298 => self.tick_n298_intro_doctor(state),
|
||||
299 => self.tick_n299_intro_balrog_misery(state),
|
||||
300 => self.tick_n300_intro_demon_crown(state),
|
||||
301 => self.tick_n301_misery_fish_missile(state, players),
|
||||
302 => self.tick_n302_camera_focus_marker(state, players, npc_list, boss),
|
||||
303 => self.tick_n303_curly_machine_gun(state, npc_list),
|
||||
304 => self.tick_n304_gaudi_hospital(state),
|
||||
305 => self.tick_n305_small_puppy(state),
|
||||
306 => self.tick_n306_balrog_nurse(state),
|
||||
307 => self.tick_n307_santa_caged(state),
|
||||
308 => self.tick_n308_stumpy(state, players),
|
||||
309 => self.tick_n309_bute(state, players),
|
||||
310 => self.tick_n310_bute_sword(state, players),
|
||||
311 => self.tick_n311_bute_archer(state, players, npc_list),
|
||||
312 => self.tick_n312_bute_arrow_projectile(state),
|
||||
313 => self.tick_n313_ma_pignon(state, players, npc_list, bullet_manager),
|
||||
314 => self.tick_n314_ma_pignon_rock(state, players, npc_list, stage),
|
||||
315 => self.tick_n315_ma_pignon_clone(state, players, bullet_manager),
|
||||
316 => self.tick_n316_bute_dead(state),
|
||||
317 => self.tick_n317_mesa(state, players, npc_list),
|
||||
318 => self.tick_n318_mesa_dead(state),
|
||||
319 => self.tick_n319_mesa_block(state, npc_list),
|
||||
320 => self.tick_n320_curly_carried(state, players, npc_list),
|
||||
321 => self.tick_n321_curly_nemesis(state, players, npc_list, bullet_manager),
|
||||
322 => self.tick_n322_deleet(state, npc_list, stage),
|
||||
323 => self.tick_n323_bute_spinning(state, players),
|
||||
324 => self.tick_n324_bute_generator(state, npc_list),
|
||||
325 => self.tick_n325_heavy_press_lightning(state, npc_list),
|
||||
326 => self.tick_n326_sue_itoh_human_transition(state, npc_list),
|
||||
327 => self.tick_n327_sneeze(state, npc_list),
|
||||
328 => self.tick_n328_human_transform_machine(state),
|
||||
329 => self.tick_n329_laboratory_fan(state),
|
||||
330 => self.tick_n330_rolling(state, npc_list, stage),
|
||||
331 => self.tick_n331_ballos_bone_projectile(state),
|
||||
332 => self.tick_n332_ballos_shockwave(state, npc_list),
|
||||
333 => self.tick_n333_ballos_lightning(state, players, npc_list),
|
||||
334 => self.tick_n334_sweat(state, players),
|
||||
335 => self.tick_n335_ikachan(state),
|
||||
336 => self.tick_n336_ikachan_generator(state, players, npc_list),
|
||||
337 => self.tick_n337_numahachi(state),
|
||||
338 => self.tick_n338_green_devil(state, stage),
|
||||
339 => self.tick_n339_green_devil_generator(state, npc_list),
|
||||
340 => self.tick_n340_ballos(state, players, npc_list, flash),
|
||||
341 => self.tick_n341_ballos_1_head(state, npc_list),
|
||||
342 => self.tick_n342_ballos_orbiting_eye(state, players, npc_list, boss),
|
||||
343 => self.tick_n343_ballos_3_cutscene(state, boss),
|
||||
344 => self.tick_n344_ballos_3_eyes(state, boss),
|
||||
345 => self.tick_n345_ballos_skull_projectile(state, npc_list, stage),
|
||||
346 => self.tick_n346_ballos_orbiting_platform(state, players, stage, boss),
|
||||
347 => self.tick_n347_hoppy(state, players),
|
||||
348 => self.tick_n348_ballos_4_spikes(state),
|
||||
349 => self.tick_n349_statue(state),
|
||||
350 => self.tick_n350_flying_bute_archer(state, players, npc_list, stage),
|
||||
351 => self.tick_n351_statue_shootable(state, npc_list),
|
||||
352 => self.tick_n352_ending_characters(state, npc_list),
|
||||
353 => self.tick_n353_bute_sword_flying(state, players),
|
||||
354 => self.tick_n354_invisible_deathtrap_wall(state, npc_list, stage),
|
||||
355 => self.tick_n355_quote_and_curly_on_balrog(state, npc_list),
|
||||
356 => self.tick_n356_balrog_rescuing(state, players, npc_list),
|
||||
357 => self.tick_n357_puppy_ghost(state),
|
||||
358 => self.tick_n358_misery_credits(state),
|
||||
359 => self.tick_n359_water_droplet_generator(state, players, npc_list),
|
||||
360 => self.tick_n360_credits_thank_you(state),
|
||||
361 => self.tick_n361_flying_gaudi(state, players),
|
||||
362 => self.tick_n362_curly_clone(state, players, npc_list),
|
||||
363 => self.tick_n363_dead_curly_clone(state, npc_list),
|
||||
364 => self.tick_n364_fast_bullet(state),
|
||||
365 => self.tick_n365_still_curly_clone(state, players, npc_list),
|
||||
366 => self.tick_n366_zombie_curly_clone(state, players),
|
||||
367 => self.tick_n367_curly_clone_incubator(state, players, npc_list),
|
||||
368 => self.tick_n368_gclone(state, players, npc_list),
|
||||
369 => self.tick_n369_gclone_curly_clone(state, players, npc_list),
|
||||
370 => self.tick_n370_second_quote(state, players, npc_list),
|
||||
0 => self.tick_n000_null(state, ctx),
|
||||
1 => self.tick_n001_experience(state, ctx),
|
||||
2 => self.tick_n002_behemoth(state, ctx),
|
||||
3 => self.tick_n003_dead_enemy(state, ctx),
|
||||
4 => self.tick_n004_smoke(state, ctx),
|
||||
5 => self.tick_n005_green_critter(state, ctx),
|
||||
6 => self.tick_n006_green_beetle(state, ctx),
|
||||
7 => self.tick_n007_basil(state, ctx),
|
||||
8 => self.tick_n008_blue_beetle(state, ctx),
|
||||
9 => self.tick_n009_balrog_falling_in(state, ctx),
|
||||
10 => self.tick_n010_balrog_shooting(state, ctx),
|
||||
11 => self.tick_n011_balrogs_projectile(state, ctx),
|
||||
12 => self.tick_n012_balrog_cutscene(state, ctx),
|
||||
13 => self.tick_n013_forcefield(state, ctx),
|
||||
14 => self.tick_n014_key(state, ctx),
|
||||
15 => self.tick_n015_chest_closed(state, ctx),
|
||||
16 => self.tick_n016_save_point(state, ctx),
|
||||
17 => self.tick_n017_health_refill(state, ctx),
|
||||
18 => self.tick_n018_door(state, ctx),
|
||||
19 => self.tick_n019_balrog_bust_in(state, ctx),
|
||||
20 => self.tick_n020_computer(state, ctx),
|
||||
21 => self.tick_n021_chest_open(state, ctx),
|
||||
22 => self.tick_n022_teleporter(state, ctx),
|
||||
23 => self.tick_n023_teleporter_lights(state, ctx),
|
||||
24 => self.tick_n024_power_critter(state, ctx),
|
||||
25 => self.tick_n025_lift(state, ctx),
|
||||
26 => self.tick_n026_bat_flying(state, ctx),
|
||||
27 => self.tick_n027_death_trap(state, ctx),
|
||||
28 => self.tick_n028_flying_critter(state, ctx),
|
||||
29 => self.tick_n029_cthulhu(state, ctx),
|
||||
30 => self.tick_n030_gunsmith(state, ctx),
|
||||
31 => self.tick_n031_bat_hanging(state, ctx),
|
||||
32 => self.tick_n032_life_capsule(state, ctx),
|
||||
33 => self.tick_n033_balrog_bouncing_projectile(state, ctx),
|
||||
34 => self.tick_n034_bed(state, ctx),
|
||||
35 => self.tick_n035_mannan(state, ctx),
|
||||
36 => self.tick_n036_balrog_hover(state, ctx),
|
||||
37 => self.tick_n037_sign(state, ctx),
|
||||
38 => self.tick_n038_fireplace(state, ctx),
|
||||
39 => self.tick_n039_save_sign(state, ctx),
|
||||
40 => self.tick_n040_santa(state, ctx),
|
||||
41 => self.tick_n041_busted_door(state, ctx),
|
||||
42 => self.tick_n042_sue(state, ctx),
|
||||
43 => self.tick_n043_chalkboard(state, ctx),
|
||||
44 => self.tick_n044_polish(state, ctx),
|
||||
45 => self.tick_n045_baby(state, ctx),
|
||||
46 => self.tick_n046_hv_trigger(state, ctx),
|
||||
47 => self.tick_n047_sandcroc(state, ctx),
|
||||
48 => self.tick_n048_omega_projectiles(state, ctx),
|
||||
49 => self.tick_n049_skullhead(state, ctx),
|
||||
50 => self.tick_n050_skeleton_projectile(state, ctx),
|
||||
51 => self.tick_n051_crow_and_skullhead(state, ctx),
|
||||
52 => self.tick_n052_sitting_blue_robot(state, ctx),
|
||||
53 => self.tick_n053_skullstep_leg(state, ctx),
|
||||
54 => self.tick_n054_skullstep(state, ctx),
|
||||
55 => self.tick_n055_kazuma(state, ctx),
|
||||
56 => self.tick_n056_tan_beetle(state, ctx),
|
||||
57 => self.tick_n057_crow(state, ctx),
|
||||
58 => self.tick_n058_basu(state, ctx),
|
||||
59 => self.tick_n059_eye_door(state, ctx),
|
||||
60 => self.tick_n060_toroko(state, ctx),
|
||||
61 => self.tick_n061_king(state, ctx),
|
||||
62 => self.tick_n062_kazuma_computer(state, ctx),
|
||||
63 => self.tick_n063_toroko_stick(state, ctx),
|
||||
64 => self.tick_n064_first_cave_critter(state, ctx),
|
||||
65 => self.tick_n065_first_cave_bat(state, ctx),
|
||||
66 => self.tick_n066_misery_bubble(state, ctx),
|
||||
67 => self.tick_n067_misery_floating(state, ctx),
|
||||
68 => self.tick_n068_balrog_running(state, ctx),
|
||||
69 => self.tick_n069_pignon(state, ctx),
|
||||
70 => self.tick_n070_sparkle(state, ctx),
|
||||
71 => self.tick_n071_chinfish(state, ctx),
|
||||
72 => self.tick_n072_sprinkler(state, ctx),
|
||||
73 => self.tick_n073_water_droplet(state, ctx),
|
||||
74 => self.tick_n074_jack(state, ctx),
|
||||
75 => self.tick_n075_kanpachi(state, ctx),
|
||||
76 => self.tick_n076_flowers(state, ctx),
|
||||
77 => self.tick_n077_yamashita(state, ctx),
|
||||
78 => self.tick_n078_pot(state, ctx),
|
||||
79 => self.tick_n079_mahin(state, ctx),
|
||||
80 => self.tick_n080_gravekeeper(state, ctx),
|
||||
81 => self.tick_n081_giant_pignon(state, ctx),
|
||||
82 => self.tick_n082_misery_standing(state, ctx),
|
||||
83 => self.tick_n083_igor_cutscene(state, ctx),
|
||||
84 => self.tick_n084_basu_projectile(state, ctx),
|
||||
85 => self.tick_n085_terminal(state, ctx),
|
||||
86 => self.tick_n086_missile_pickup(state, ctx),
|
||||
87 => self.tick_n087_heart_pickup(state, ctx),
|
||||
88 => self.tick_n088_igor_boss(state, ctx),
|
||||
89 => self.tick_n089_igor_dead(state, ctx),
|
||||
90 => self.tick_n090_background(state, ctx),
|
||||
91 => self.tick_n091_mimiga_cage(state, ctx),
|
||||
92 => self.tick_n092_sue_at_pc(state, ctx),
|
||||
93 => self.tick_n093_chaco(state, ctx),
|
||||
94 => self.tick_n094_kulala(state, ctx),
|
||||
95 => self.tick_n095_jelly(state, ctx),
|
||||
96 => self.tick_n096_fan_left(state, ctx),
|
||||
97 => self.tick_n097_fan_up(state, ctx),
|
||||
98 => self.tick_n098_fan_right(state, ctx),
|
||||
99 => self.tick_n099_fan_down(state, ctx),
|
||||
100 => self.tick_n100_grate(state, ctx),
|
||||
101 => self.tick_n101_malco_screen(state, ctx),
|
||||
102 => self.tick_n102_malco_computer_wave(state, ctx),
|
||||
103 => self.tick_n103_mannan_projectile(state, ctx),
|
||||
104 => self.tick_n104_frog(state, ctx),
|
||||
105 => self.tick_n105_hey_bubble_low(state, ctx),
|
||||
106 => self.tick_n106_hey_bubble_high(state, ctx),
|
||||
107 => self.tick_n107_malco_broken(state, ctx),
|
||||
108 => self.tick_n108_balfrog_projectile(state, ctx),
|
||||
109 => self.tick_n109_malco_powered_on(state, ctx),
|
||||
110 => self.tick_n110_puchi(state, ctx),
|
||||
111 => self.tick_n111_quote_teleport_out(state, ctx),
|
||||
112 => self.tick_n112_quote_teleport_in(state, ctx),
|
||||
113 => self.tick_n113_professor_booster(state, ctx),
|
||||
114 => self.tick_n114_press(state, ctx),
|
||||
115 => self.tick_n115_ravil(state, ctx),
|
||||
116 => self.tick_n116_red_petals(state, ctx),
|
||||
117 => self.tick_n117_curly(state, ctx),
|
||||
118 => self.tick_n118_curly_boss(state, ctx),
|
||||
119 => self.tick_n119_table_chair(state, ctx),
|
||||
120 => self.tick_n120_colon_a(state, ctx),
|
||||
121 => self.tick_n121_colon_b(state, ctx),
|
||||
122 => self.tick_n122_colon_enraged(state, ctx),
|
||||
123 => self.tick_n123_curly_boss_bullet(state, ctx),
|
||||
124 => self.tick_n124_sunstone(state, ctx),
|
||||
125 => self.tick_n125_hidden_item(state, ctx),
|
||||
126 => self.tick_n126_puppy_running(state, ctx),
|
||||
127 => self.tick_n127_machine_gun_trail_l2(state, ctx),
|
||||
128 => self.tick_n128_machine_gun_trail_l3(state, ctx),
|
||||
129 => self.tick_n129_fireball_snake_trail(state, ctx),
|
||||
130 => self.tick_n130_puppy_sitting(state, ctx),
|
||||
131 => self.tick_n131_puppy_sleeping(state, ctx),
|
||||
132 => self.tick_n132_puppy_barking(state, ctx),
|
||||
133 => self.tick_n133_jenka(state, ctx),
|
||||
134 => self.tick_n134_armadillo(state, ctx),
|
||||
135 => self.tick_n135_skeleton(state, ctx),
|
||||
136 => self.tick_n136_puppy_carried(state, ctx),
|
||||
137 => self.tick_n137_large_door_frame(state, ctx),
|
||||
138 => self.tick_n138_large_door(state, ctx),
|
||||
139 => self.tick_n139_doctor(state, ctx),
|
||||
140 => self.tick_n140_toroko_frenzied(state, ctx),
|
||||
141 => self.tick_n141_toroko_block_projectile(state, ctx),
|
||||
142 => self.tick_n142_flower_cub(state, ctx),
|
||||
143 => self.tick_n143_jenka_collapsed(state, ctx),
|
||||
144 => self.tick_n144_toroko_teleporting_in(state, ctx),
|
||||
145 => self.tick_n145_king_sword(state, ctx),
|
||||
146 => self.tick_n146_lightning(state, ctx),
|
||||
147 => self.tick_n147_critter_purple(state, ctx),
|
||||
148 => self.tick_n148_critter_purple_projectile(state, ctx),
|
||||
149 => self.tick_n149_horizontal_moving_block(state, ctx),
|
||||
150 => self.tick_n150_quote(state, ctx),
|
||||
151 => self.tick_n151_blue_robot_standing(state, ctx),
|
||||
152 => self.tick_n152_shutter_stuck(state, ctx),
|
||||
153 => self.tick_n153_gaudi(state, ctx),
|
||||
154 => self.tick_n154_gaudi_dead(state, ctx),
|
||||
155 => self.tick_n155_gaudi_flying(state, ctx),
|
||||
156 => self.tick_n156_gaudi_projectile(state, ctx),
|
||||
157 => self.tick_n157_vertical_moving_block(state, ctx),
|
||||
158 => self.tick_n158_fish_missile(state, ctx),
|
||||
159 => self.tick_n159_monster_x_defeated(state, ctx),
|
||||
160 => self.tick_n160_puu_black(state, ctx),
|
||||
161 => self.tick_n161_puu_black_projectile(state, ctx),
|
||||
162 => self.tick_n162_puu_black_dead(state, ctx),
|
||||
163 => self.tick_n163_dr_gero(state, ctx),
|
||||
164 => self.tick_n164_nurse_hasumi(state, ctx),
|
||||
165 => self.tick_n165_curly_collapsed(state, ctx),
|
||||
166 => self.tick_n166_chaba(state, ctx),
|
||||
167 => self.tick_n167_booster_falling(state, ctx),
|
||||
168 => self.tick_n168_boulder(state, ctx),
|
||||
169 => self.tick_n169_balrog_shooting_missiles(state, ctx),
|
||||
170 => self.tick_n170_balrog_missile(state, ctx),
|
||||
171 => self.tick_n171_fire_whirrr(state, ctx),
|
||||
172 => self.tick_n172_fire_whirrr_projectile(state, ctx),
|
||||
173 => self.tick_n173_gaudi_armored(state, ctx),
|
||||
174 => self.tick_n174_gaudi_armored_projectile(state, ctx),
|
||||
175 => self.tick_n175_gaudi_egg(state, ctx),
|
||||
176 => self.tick_n176_buyo_buyo_base(state, ctx),
|
||||
177 => self.tick_n177_buyo_buyo(state, ctx),
|
||||
178 => self.tick_n178_core_blade_projectile(state, ctx),
|
||||
179 => self.tick_n179_core_wisp_projectile(state, ctx),
|
||||
180 => self.tick_n180_curly_ai(state, ctx),
|
||||
181 => self.tick_n181_curly_ai_machine_gun(state, ctx),
|
||||
182 => self.tick_n182_curly_ai_polar_star(state, ctx),
|
||||
183 => self.tick_n183_curly_air_tank_bubble(state, ctx),
|
||||
184 => self.tick_n184_shutter(state, ctx),
|
||||
185 => self.tick_n185_small_shutter(state, ctx),
|
||||
186 => self.tick_n186_lift_block(state, ctx),
|
||||
187 => self.tick_n187_fuzz_core(state, ctx),
|
||||
188 => self.tick_n188_fuzz(state, ctx),
|
||||
189 => self.tick_n189_homing_flame(state, ctx),
|
||||
190 => self.tick_n190_broken_robot(state, ctx),
|
||||
191 => self.tick_n191_water_level(state, ctx),
|
||||
192 => self.tick_n192_scooter(state, ctx),
|
||||
193 => self.tick_n193_broken_scooter(state, ctx),
|
||||
194 => self.tick_n194_broken_blue_robot(state, ctx),
|
||||
195 => self.tick_n195_background_grate(state, ctx),
|
||||
196 => self.tick_n196_ironhead_wall(state, ctx),
|
||||
197 => self.tick_n197_porcupine_fish(state, ctx),
|
||||
198 => self.tick_n198_ironhead_projectile(state, ctx),
|
||||
199 => self.tick_n199_wind_particles(state, ctx),
|
||||
200 => self.tick_n200_zombie_dragon(state, ctx),
|
||||
201 => self.tick_n201_zombie_dragon_dead(state, ctx),
|
||||
202 => self.tick_n202_zombie_dragon_projectile(state, ctx),
|
||||
203 => self.tick_n203_critter_destroyed_egg_corridor(state, ctx),
|
||||
204 => self.tick_n204_small_falling_spike(state, ctx),
|
||||
205 => self.tick_n205_large_falling_spike(state, ctx),
|
||||
206 => self.tick_n206_counter_bomb(state, ctx),
|
||||
207 => self.tick_n207_counter_bomb_countdown(state, ctx),
|
||||
208 => self.tick_n208_basu_destroyed_egg_corridor(state, ctx),
|
||||
209 => self.tick_n209_basu_projectile_destroyed_egg_corridor(state, ctx),
|
||||
210 => self.tick_n210_beetle_destroyed_egg_corridor(state, ctx),
|
||||
211 => self.tick_n211_small_spikes(state, ctx),
|
||||
212 => self.tick_n212_sky_dragon(state, ctx),
|
||||
213 => self.tick_n213_night_spirit(state, ctx),
|
||||
214 => self.tick_n214_night_spirit_projectile(state, ctx),
|
||||
215 => self.tick_n215_sandcroc_outer_wall(state, ctx),
|
||||
216 => self.tick_n216_debug_cat(state, ctx),
|
||||
217 => self.tick_n217_itoh(state, ctx),
|
||||
218 => self.tick_n218_core_giant_ball(state, ctx),
|
||||
219 => self.tick_n219_smoke_generator(state, ctx),
|
||||
220 => self.tick_n220_shovel_brigade(state, ctx),
|
||||
221 => self.tick_n221_shovel_brigade_walking(state, ctx),
|
||||
222 => self.tick_n222_prison_bars(state, ctx),
|
||||
223 => self.tick_n223_momorin(state, ctx),
|
||||
224 => self.tick_n224_chie(state, ctx),
|
||||
225 => self.tick_n225_megane(state, ctx),
|
||||
226 => self.tick_n226_kanpachi_plantation(state, ctx),
|
||||
227 => self.tick_n227_bucket(state, ctx),
|
||||
228 => self.tick_n228_droll(state, ctx),
|
||||
229 => self.tick_n229_red_flowers_sprouts(state, ctx),
|
||||
230 => self.tick_n230_red_flowers_blooming(state, ctx),
|
||||
231 => self.tick_n231_rocket(state, ctx),
|
||||
232 => self.tick_n232_orangebell(state, ctx),
|
||||
233 => self.tick_n233_orangebell_bat(state, ctx),
|
||||
234 => self.tick_n234_red_flowers_picked(state, ctx),
|
||||
235 => self.tick_n235_midorin(state, ctx),
|
||||
236 => self.tick_n236_gunfish(state, ctx),
|
||||
237 => self.tick_n237_gunfish_projectile(state, ctx),
|
||||
238 => self.tick_n238_press_sideways(state, ctx),
|
||||
239 => self.tick_n239_cage_bars(state, ctx),
|
||||
240 => self.tick_n240_mimiga_jailed(state, ctx),
|
||||
241 => self.tick_n241_critter_red(state, ctx),
|
||||
242 => self.tick_n242_bat_last_cave(state, ctx),
|
||||
243 => self.tick_n243_bat_generator(state, ctx),
|
||||
244 => self.tick_n244_lava_drop(state, ctx),
|
||||
245 => self.tick_n245_lava_drop_generator(state, ctx),
|
||||
246 => self.tick_n246_press_proximity(state, ctx),
|
||||
247 => self.tick_n247_misery_boss(state, ctx),
|
||||
248 => self.tick_n248_misery_boss_vanishing(state, ctx),
|
||||
249 => self.tick_n249_misery_boss_appearing(state, ctx),
|
||||
250 => self.tick_n250_misery_boss_lightning_ball(state, ctx),
|
||||
251 => self.tick_n251_misery_boss_lightning(state, ctx),
|
||||
252 => self.tick_n252_misery_boss_bats(state, ctx),
|
||||
253 => self.tick_n253_experience_capsule(state, ctx),
|
||||
254 => self.tick_n254_helicopter(state, ctx),
|
||||
255 => self.tick_n255_helicopter_blades(state, ctx),
|
||||
256 => self.tick_n256_doctor_facing_away(state, ctx),
|
||||
257 => self.tick_n257_red_crystal(state, ctx),
|
||||
258 => self.tick_n258_mimiga_sleeping(state, ctx),
|
||||
259 => self.tick_n259_curly_unconscious(state, ctx),
|
||||
260 => self.tick_n260_shovel_brigade_caged(state, ctx),
|
||||
261 => self.tick_n261_chie_caged(state, ctx),
|
||||
262 => self.tick_n262_chaco_caged(state, ctx),
|
||||
263 => self.tick_n263_doctor_boss(state, ctx),
|
||||
264 => self.tick_n264_doctor_boss_red_projectile(state, ctx),
|
||||
265 => self.tick_n265_doctor_boss_red_projectile_trail(state, ctx),
|
||||
266 => self.tick_n266_doctor_boss_red_projectile_bouncing(state, ctx),
|
||||
267 => self.tick_n267_muscle_doctor(state, ctx),
|
||||
268 => self.tick_n268_igor_enemy(state, ctx),
|
||||
269 => self.tick_n269_red_bat_bouncing(state, ctx),
|
||||
270 => self.tick_n270_doctor_red_energy(state, ctx),
|
||||
271 => self.tick_n271_ironhead_block(state, ctx),
|
||||
272 => self.tick_n272_ironhead_block_generator(state, ctx),
|
||||
273 => self.tick_n273_droll_projectile(state, ctx),
|
||||
274 => self.tick_n274_droll(state, ctx),
|
||||
275 => self.tick_n275_puppy_plantation(state, ctx),
|
||||
276 => self.tick_n276_red_demon(state, ctx),
|
||||
277 => self.tick_n277_red_demon_projectile(state, ctx),
|
||||
278 => self.tick_n278_little_family(state, ctx),
|
||||
279 => self.tick_n279_large_falling_block(state, ctx),
|
||||
280 => self.tick_n280_sue_teleported(state, ctx),
|
||||
281 => self.tick_n281_doctor_energy_form(state, ctx),
|
||||
282 => self.tick_n282_mini_undead_core_active(state, ctx),
|
||||
283 => self.tick_n283_misery_possessed(state, ctx),
|
||||
284 => self.tick_n284_sue_possessed(state, ctx),
|
||||
285 => self.tick_n285_undead_core_spiral_projectile(state, ctx),
|
||||
286 => self.tick_n286_undead_core_spiral_projectile_trail(state, ctx),
|
||||
287 => self.tick_n287_orange_smoke(state, ctx),
|
||||
288 => self.tick_n288_undead_core_exploding_rock(state, ctx),
|
||||
289 => self.tick_n289_critter_orange(state, ctx),
|
||||
290 => self.tick_n290_bat_misery(state, ctx),
|
||||
291 => self.tick_n291_mini_undead_core_inactive(state, ctx),
|
||||
292 => self.tick_n292_quake(state, ctx),
|
||||
293 => self.tick_n293_undead_core_energy_shot(state, ctx),
|
||||
294 => self.tick_n294_quake_falling_block_generator(state, ctx),
|
||||
295 => self.tick_n295_cloud(state, ctx),
|
||||
296 => self.tick_n296_cloud_generator(state, ctx),
|
||||
297 => self.tick_n297_sue_dragon_mouth(state, ctx),
|
||||
298 => self.tick_n298_intro_doctor(state, ctx),
|
||||
299 => self.tick_n299_intro_balrog_misery(state, ctx),
|
||||
300 => self.tick_n300_intro_demon_crown(state, ctx),
|
||||
301 => self.tick_n301_misery_fish_missile(state, ctx),
|
||||
302 => self.tick_n302_camera_focus_marker(state, ctx),
|
||||
303 => self.tick_n303_curly_machine_gun(state, ctx),
|
||||
304 => self.tick_n304_gaudi_hospital(state, ctx),
|
||||
305 => self.tick_n305_small_puppy(state, ctx),
|
||||
306 => self.tick_n306_balrog_nurse(state, ctx),
|
||||
307 => self.tick_n307_santa_caged(state, ctx),
|
||||
308 => self.tick_n308_stumpy(state, ctx),
|
||||
309 => self.tick_n309_bute(state, ctx),
|
||||
310 => self.tick_n310_bute_sword(state, ctx),
|
||||
311 => self.tick_n311_bute_archer(state, ctx),
|
||||
312 => self.tick_n312_bute_arrow_projectile(state, ctx),
|
||||
313 => self.tick_n313_ma_pignon(state, ctx),
|
||||
314 => self.tick_n314_ma_pignon_rock(state, ctx),
|
||||
315 => self.tick_n315_ma_pignon_clone(state, ctx),
|
||||
316 => self.tick_n316_bute_dead(state, ctx),
|
||||
317 => self.tick_n317_mesa(state, ctx),
|
||||
318 => self.tick_n318_mesa_dead(state, ctx),
|
||||
319 => self.tick_n319_mesa_block(state, ctx),
|
||||
320 => self.tick_n320_curly_carried(state, ctx),
|
||||
321 => self.tick_n321_curly_nemesis(state, ctx),
|
||||
322 => self.tick_n322_deleet(state, ctx),
|
||||
323 => self.tick_n323_bute_spinning(state, ctx),
|
||||
324 => self.tick_n324_bute_generator(state, ctx),
|
||||
325 => self.tick_n325_heavy_press_lightning(state, ctx),
|
||||
326 => self.tick_n326_sue_itoh_human_transition(state, ctx),
|
||||
327 => self.tick_n327_sneeze(state, ctx),
|
||||
328 => self.tick_n328_human_transform_machine(state, ctx),
|
||||
329 => self.tick_n329_laboratory_fan(state, ctx),
|
||||
330 => self.tick_n330_rolling(state, ctx),
|
||||
331 => self.tick_n331_ballos_bone_projectile(state, ctx),
|
||||
332 => self.tick_n332_ballos_shockwave(state, ctx),
|
||||
333 => self.tick_n333_ballos_lightning(state, ctx),
|
||||
334 => self.tick_n334_sweat(state, ctx),
|
||||
335 => self.tick_n335_ikachan(state, ctx),
|
||||
336 => self.tick_n336_ikachan_generator(state, ctx),
|
||||
337 => self.tick_n337_numahachi(state, ctx),
|
||||
338 => self.tick_n338_green_devil(state, ctx),
|
||||
339 => self.tick_n339_green_devil_generator(state, ctx),
|
||||
340 => self.tick_n340_ballos(state, ctx),
|
||||
341 => self.tick_n341_ballos_1_head(state, ctx),
|
||||
342 => self.tick_n342_ballos_orbiting_eye(state, ctx),
|
||||
343 => self.tick_n343_ballos_3_cutscene(state, ctx),
|
||||
344 => self.tick_n344_ballos_3_eyes(state, ctx),
|
||||
345 => self.tick_n345_ballos_skull_projectile(state, ctx),
|
||||
346 => self.tick_n346_ballos_orbiting_platform(state, ctx),
|
||||
347 => self.tick_n347_hoppy(state, ctx),
|
||||
348 => self.tick_n348_ballos_4_spikes(state, ctx),
|
||||
349 => self.tick_n349_statue(state, ctx),
|
||||
350 => self.tick_n350_flying_bute_archer(state, ctx),
|
||||
351 => self.tick_n351_statue_shootable(state, ctx),
|
||||
352 => self.tick_n352_ending_characters(state, ctx),
|
||||
353 => self.tick_n353_bute_sword_flying(state, ctx),
|
||||
354 => self.tick_n354_invisible_deathtrap_wall(state, ctx),
|
||||
355 => self.tick_n355_quote_and_curly_on_balrog(state, ctx),
|
||||
356 => self.tick_n356_balrog_rescuing(state, ctx),
|
||||
357 => self.tick_n357_puppy_ghost(state, ctx),
|
||||
358 => self.tick_n358_misery_credits(state, ctx),
|
||||
359 => self.tick_n359_water_droplet_generator(state, ctx),
|
||||
360 => self.tick_n360_credits_thank_you(state, ctx),
|
||||
361 => self.tick_n361_flying_gaudi(state, ctx),
|
||||
362 => self.tick_n362_curly_clone(state, ctx),
|
||||
363 => self.tick_n363_dead_curly_clone(state, ctx),
|
||||
364 => self.tick_n364_fast_bullet(state, ctx),
|
||||
365 => self.tick_n365_still_curly_clone(state, ctx),
|
||||
366 => self.tick_n366_zombie_curly_clone(state, ctx),
|
||||
367 => self.tick_n367_curly_clone_incubator(state, ctx),
|
||||
368 => self.tick_n368_gclone(state, ctx),
|
||||
369 => self.tick_n369_gclone_curly_clone(state, ctx),
|
||||
370 => self.tick_n370_second_quote(state, ctx),
|
||||
_ => Ok(()),
|
||||
}?;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ use crate::entity::GameEntity;
|
|||
use crate::framework::context::Context;
|
||||
use crate::framework::error::GameResult;
|
||||
use crate::game::frame::UpdateTarget;
|
||||
use crate::game::npc::NPCContext;
|
||||
use crate::game::npc::NPC;
|
||||
use crate::game::player::{ControlMode, TargetPlayer};
|
||||
use crate::game::scripting::tsc::bytecode_utils::read_cur_varint;
|
||||
|
@ -1642,14 +1643,14 @@ impl TextScriptVM {
|
|||
|
||||
npc.tick(
|
||||
state,
|
||||
(
|
||||
[&mut game_scene.player1, &mut game_scene.player2],
|
||||
&game_scene.npc_list,
|
||||
&mut game_scene.stage,
|
||||
&mut game_scene.bullet_manager,
|
||||
&mut game_scene.flash,
|
||||
&mut game_scene.boss,
|
||||
),
|
||||
NPCContext {
|
||||
players: [&mut game_scene.player1, &mut game_scene.player2],
|
||||
npc_list: &game_scene.npc_list,
|
||||
stage: &mut game_scene.stage,
|
||||
bullet_manager: &mut game_scene.bullet_manager,
|
||||
flash: &mut game_scene.flash,
|
||||
boss: &mut game_scene.boss,
|
||||
},
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,9 +34,9 @@ use crate::game::caret::CaretType;
|
|||
use crate::game::frame::{Frame, UpdateTarget};
|
||||
use crate::game::inventory::{Inventory, TakeExperienceResult};
|
||||
use crate::game::map::WaterParams;
|
||||
use crate::game::npc::boss::BossNPC;
|
||||
use crate::game::npc::boss::{BossNPC, BossNPCContext};
|
||||
use crate::game::npc::list::NPCList;
|
||||
use crate::game::npc::{NPCLayer, NPC};
|
||||
use crate::game::npc::{NPCContext, NPCLayer, NPC};
|
||||
use crate::game::physics::{PhysicalEntity, OFFSETS};
|
||||
use crate::game::player::{ControlMode, Player, TargetPlayer};
|
||||
use crate::game::scripting::tsc::credit_script::CreditScriptVM;
|
||||
|
@ -1120,8 +1120,7 @@ impl GameScene {
|
|||
let mut droplet = NPC::create(73, &state.npc_table);
|
||||
droplet.cond.set_alive(true);
|
||||
droplet.y = npc.y;
|
||||
droplet.direction =
|
||||
if npc.flags.bloody_droplets() { Direction::Right } else { Direction::Left };
|
||||
droplet.direction = if npc.flags.bloody_droplets() { Direction::Right } else { Direction::Left };
|
||||
|
||||
for _ in 0..7 {
|
||||
droplet.x = npc.x + (npc.rng.range(-8..8) * 0x200) as i32;
|
||||
|
@ -1379,25 +1378,25 @@ impl GameScene {
|
|||
for npc in self.npc_list.iter_alive() {
|
||||
npc.tick(
|
||||
state,
|
||||
(
|
||||
[&mut self.player1, &mut self.player2],
|
||||
&self.npc_list,
|
||||
&mut self.stage,
|
||||
&mut self.bullet_manager,
|
||||
&mut self.flash,
|
||||
&mut self.boss,
|
||||
),
|
||||
NPCContext {
|
||||
players: [&mut self.player1, &mut self.player2],
|
||||
npc_list: &self.npc_list,
|
||||
stage: &mut self.stage,
|
||||
bullet_manager: &mut self.bullet_manager,
|
||||
flash: &mut self.flash,
|
||||
boss: &mut self.boss,
|
||||
},
|
||||
)?;
|
||||
}
|
||||
self.boss.tick(
|
||||
state,
|
||||
(
|
||||
[&mut self.player1, &mut self.player2],
|
||||
&self.npc_list,
|
||||
&mut self.stage,
|
||||
&self.bullet_manager,
|
||||
&mut self.flash,
|
||||
),
|
||||
BossNPCContext {
|
||||
players: [&mut self.player1, &mut self.player2],
|
||||
npc_list: &self.npc_list,
|
||||
stage: &mut self.stage,
|
||||
bullet_manager: &mut self.bullet_manager,
|
||||
flash: &mut self.flash,
|
||||
},
|
||||
)?;
|
||||
//decides if the player is tangible or not
|
||||
if !state.settings.noclip {
|
||||
|
@ -2181,7 +2180,9 @@ impl Scene for GameScene {
|
|||
self.falling_island.draw(state, ctx, &self.frame)?;
|
||||
self.text_boxes.draw(state, ctx, &self.frame)?;
|
||||
|
||||
if (self.skip_counter > 1 || state.tutorial_counter > 0) && (state.settings.cutscene_skip_mode != CutsceneSkipMode::Auto) {
|
||||
if (self.skip_counter > 1 || state.tutorial_counter > 0)
|
||||
&& (state.settings.cutscene_skip_mode != CutsceneSkipMode::Auto)
|
||||
{
|
||||
let key = {
|
||||
if state.settings.touch_controls {
|
||||
">>".to_owned()
|
||||
|
|
Loading…
Reference in a new issue