1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-12-01 08:37:23 +00:00

a bunch of npc bugfixes

This commit is contained in:
Alula 2021-05-05 18:34:14 +02:00
parent aed30141b4
commit 1360794264
No known key found for this signature in database
GPG key ID: 3E00485503A1D8BA
19 changed files with 119 additions and 119 deletions

View file

@ -109,9 +109,9 @@ impl NPC {
npc.cond.set_alive(true);
npc.x = self.x;
npc.y = self.y + 4 * 0x200; // 4.0fix9
npc.y = self.y + 0x800; // 4.0fix9
let mut angle = ((self.y + 4 * 0x200 - player.y) as f64 / (self.x - player.y) as f64).atan();
let mut angle = ((self.y + 0x800 - player.y) as f64 / (self.x - player.y) as f64).atan();
angle += self.rng.range(-16..16) as f64 * std::f64::consts::FRAC_PI_8;
npc.vel_x = (angle.cos() * 512.0) as i32; // 1.0fix9
npc.vel_y = (angle.sin() * 512.0) as i32;
@ -132,7 +132,7 @@ impl NPC {
self.action_num = 4;
self.action_counter = 0;
self.vel_x = (player.x - self.x) / 0x64;
self.vel_y = -3 * 0x200;
self.vel_y = -0x600;
self.anim_num = 3;
}
}
@ -141,7 +141,7 @@ impl NPC {
self.vel_x = 0;
}
self.damage = if self.y + 16 * 0x200 < player.y { 5 } else { 0 };
self.damage = if self.y + 0x2000 < player.y { 5 } else { 0 };
if self.flags.hit_bottom_wall() {
self.action_num = 5;
@ -271,7 +271,7 @@ impl NPC {
self.action_num = 12;
self.action_counter = 0;
self.anim_num = 3;
self.vel_y = -4 * 0x200;
self.vel_y = -0x800;
self.npc_flags.set_ignore_solidity(true);
}
}
@ -456,7 +456,7 @@ impl NPC {
self.action_num = 102;
self.action_counter = 0;
self.anim_num = 3;
self.vel_y = -4 * 0x200;
self.vel_y = -0x800;
self.npc_flags.set_ignore_solidity(true);
for npc in npc_list.iter_alive().filter(|npc| npc.npc_type == 117 || npc.npc_type == 150) {
@ -473,8 +473,8 @@ impl NPC {
}
}
102 => {
let x = clamp(self.x / (16 * 0x200), 0, stage.map.width as i32) as usize;
let y = clamp(self.y / (16 * 0x200), 0, stage.map.height as i32) as usize;
let x = clamp(self.x / (0x2000), 0, stage.map.width as i32) as usize;
let y = clamp(self.y / (0x2000), 0, stage.map.height as i32) as usize;
if y <= 34 && stage.change_tile(x, y, 0) {
state.sound_manager.play_sfx(44);
@ -482,20 +482,20 @@ impl NPC {
let mut npc = NPC::create(4, &state.npc_table);
npc.cond.set_alive(true);
npc.x = x as i32 * 16 * 0x200;
npc.y = y as i32 * 16 * 0x200;
npc.x = x as i32 * 0x2000;
npc.y = y as i32 * 0x2000;
let _ = npc_list.spawn(0x100, npc.clone());
let _ = npc_list.spawn(0x100, npc.clone());
if x > 0 && stage.change_tile(x - 1, y, 0) {
npc.x = (x - 1) as i32 * 16 * 0x200;
npc.x = (x - 1) as i32 * 0x2000;
let _ = npc_list.spawn(0x100, npc.clone());
let _ = npc_list.spawn(0x100, npc.clone());
}
if x < stage.map.width as usize && stage.change_tile(x + 1, y, 0) {
npc.x = (x + 1) as i32 * 16 * 0x200;
npc.x = (x + 1) as i32 * 0x2000;
let _ = npc_list.spawn(0x100, npc.clone());
let _ = npc_list.spawn(0x100, npc);
}
@ -623,7 +623,7 @@ impl NPC {
self.cond.set_alive(false);
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
} else if self.flags.hit_bottom_wall() {
self.vel_y = -2 * 0x200;
self.vel_y = -0x400;
}
self.vel_y += 0x2a;
@ -688,7 +688,7 @@ impl NPC {
npc.vel_x = (angle.cos() * -512.0) as i32;
npc.vel_y = (angle.sin() * -512.0) as i32;
npc.x = self.x;
npc.y = self.y + 4 * 0x200;
npc.y = self.y + 0x800;
let _ = npc_list.spawn(0x100, npc);
state.sound_manager.play_sfx(39);
@ -707,7 +707,7 @@ impl NPC {
self.anim_num = 3;
self.vel_x = (player.x - self.x) / 100;
self.vel_y = -3 * 0x200;
self.vel_y = -0x600;
}
}
4 => {
@ -744,7 +744,7 @@ impl NPC {
self.vel_y = clamp(self.vel_y, -0x200, 0x200);
}
6 => {
if self.y + 16 * 0x200 < player.y {
if self.y + 0x2000 < player.y {
self.damage = 10;
} else {
self.damage = 0;
@ -870,7 +870,7 @@ impl NPC {
let pi = self.get_closest_player_idx_mut(&players);
if self.action_counter >= 8 && (players[pi].x - self.x).abs() < 12 * 0x200 // 12.0fix9
&& self.y - 12 * 0x200 < players[pi].y && self.y + 8 * 0x200 > players[pi].y
&& self.y - 12 * 0x200 < players[pi].y && self.y + 0x1000 > players[pi].y
{
// 12.0fix9 / 8.0fix9
self.action_num = 10;
@ -887,7 +887,7 @@ impl NPC {
} else if (self.action_counter2 % 3 == 0) && self.action_counter > 25 {
self.action_num = 4;
self.anim_num = 7;
self.vel_y = -2 * 0x200; // -2.0fix9
self.vel_y = -0x400; // -2.0fix9
}
}
}
@ -903,7 +903,7 @@ impl NPC {
if self.action_counter >= 8
&& (players[pi].x - self.x).abs() < 12 * 0x200
&& self.y - 12 * 0x200 < players[pi].y
&& self.y + 8 * 0x200 > players[pi].y
&& self.y + 0x1000 > players[pi].y
{
self.action_num = 10;
self.anim_num = 5;
@ -962,8 +962,8 @@ impl NPC {
self.direction = self.direction.opposite();
player.direction = self.direction;
player.x += 4 * 0x200 * self.direction.vector_x();
player.y -= 8 * 0x200;
player.x += 0x800 * self.direction.vector_x();
player.y -= 0x1000;
player.vel_x = 0x5ff * self.direction.vector_x();
player.vel_y = -0x200;

View file

@ -47,9 +47,9 @@ impl NPC {
self.action_num = 31;
self.anim_num = 0;
self.anim_counter = 0;
self.hit_bounds.bottom = 16 * 0x200;
self.x -= 16 * 0x200;
self.y += 8 * 0x200;
self.hit_bounds.bottom = 0x2000;
self.x -= 0x2000;
self.y += 0x1000;
// interpolation glitch fix
self.prev_x = self.x;
self.prev_y = self.y;
@ -66,7 +66,7 @@ impl NPC {
if self.action_counter > 20 {
self.action_num = 33;
self.anim_num = 1;
self.hit_bounds.bottom = 8 * 0x200;
self.hit_bounds.bottom = 0x1000;
}
}
33 => {

View file

@ -26,7 +26,7 @@ impl NPC {
let player = self.get_closest_player_mut(players);
if (self.x - player.x).abs() < 32 * 0x200
&& self.y - 32 * 0x200 < player.y
&& self.y + 16 * 0x200 > player.y {
&& self.y + 0x2000 > player.y {
self.direction = if self.x > player.x { Direction::Left } else { Direction::Right };
}
}

View file

@ -18,7 +18,7 @@ impl NPC {
let player = self.get_closest_player_mut(players);
if abs(self.x - player.x) < 48 * 0x200 && self.y - 48 * 0x200 < player.y && self.y + 16 * 0x200 > player.y {
if abs(self.x - player.x) < 48 * 0x200 && self.y - 48 * 0x200 < player.y && self.y + 0x2000 > player.y {
self.anim_num = 1;
} else {
self.anim_num = 0;
@ -251,8 +251,8 @@ impl NPC {
match self.action_num {
0 | 1 => {
if self.action_num == 0 {
self.x -= 4 * 0x200;
self.y += 16 * 0x200;
self.x -= 0x800;
self.y += 0x2000;
self.action_num = 1;
self.anim_num = 0;
self.anim_counter = 0;

View file

@ -101,7 +101,7 @@ impl NPC {
match self.action_num {
0 | 1 => {
if self.action_num == 0 {
self.y += 3 * 0x200;
self.y += 0x600;
self.action_num = 1;
self.anim_num = 0;
self.anim_rect = state.constants.npc.n005_green_critter[self.anim_num as usize + if self.direction == Direction::Right { 3 } else { 0 }];
@ -378,7 +378,7 @@ impl NPC {
0 => {
let player = self.get_closest_player_mut(players);
if player.x < self.x + 16 * 0x200 && player.x > self.x - 16 * 0x200 {
if player.x < self.x + 0x2000 && player.x > self.x - 0x2000 {
self.npc_flags.set_shootable(true);
self.vel_y = -0x100;
self.target_y = self.y;
@ -455,7 +455,7 @@ impl NPC {
match self.action_num {
0 | 1 => {
if self.action_num == 0 {
self.x += 8 * 0x200;
self.x += 0x1000;
self.action_num = 1;
self.anim_num = 0;
self.anim_counter = 1;
@ -549,7 +549,7 @@ impl NPC {
match self.action_num {
0 => {
if player.x < self.x + 16 * 0x200 && player.x > self.x - 16 * 0x200 {
if player.x < self.x + 0x2000 && player.x > self.x - 0x2000 {
self.target_x = self.x;
self.target_y = self.y;
self.action_num = 1;
@ -560,7 +560,7 @@ impl NPC {
self.tsc_direction = self.direction as u16;
self.npc_flags.set_shootable(true);
self.x = player.x + self.direction.vector_x() * 16 * 16 * 0x200;
self.x = player.x + self.direction.vector_x() * 16 * 0x2000;
self.vel_x = self.direction.vector_x() * 0x2ff;
} else {
self.anim_rect = Rect::new(0, 0, 0, 0);
@ -721,7 +721,7 @@ impl NPC {
match self.action_num {
0 => {
if player.x < self.x + 16 * 0x200 && player.x > self.x - 16 * 0x200 {
if player.x < self.x + 0x2000 && player.x > self.x - 0x2000 {
self.target_x = self.x;
self.target_y = self.y;
self.action_num = 1;
@ -732,7 +732,7 @@ impl NPC {
self.tsc_direction = self.direction as u16;
self.npc_flags.set_shootable(true);
self.x = player.x + self.direction.vector_x() * 16 * 16 * 0x200;
self.x = player.x + self.direction.vector_x() * 16 * 0x2000;
self.vel_x = self.direction.vector_x() * 0x2ff;
} else {
self.anim_rect = Rect::new(0, 0, 0, 0);

View file

@ -71,7 +71,7 @@ impl NPC {
match self.action_num {
0 | 1 => {
if self.action_num == 0 {
self.y += 3 * 0x200;
self.y += 0x600;
self.action_num = 1;
self.anim_num = 0;
self.anim_rect = state.constants.npc.n064_first_cave_critter[self.anim_num as usize + if self.direction == Direction::Right { 3 } else { 0 }];

View file

@ -177,7 +177,7 @@ impl NPC {
if self.action_counter2 < 120 {
self.action_counter2 += 1;
} else if abs(self.x - player.x) < 8 * 0x200 && self.y < player.y && self.y + 96 * 0x200 > player.y {
} else if abs(self.x - player.x) < 0x1000 && self.y < player.y && self.y + 96 * 0x200 > player.y {
self.vel_x /= 2;
self.vel_y = 0;
self.action_num = 3;
@ -226,7 +226,7 @@ impl NPC {
match self.action_num {
0 | 1 => {
if self.action_num == 0 {
self.y += 3 * 0x200;
self.y += 0x600;
self.action_num = 1;
}
@ -370,7 +370,7 @@ impl NPC {
self.anim_num = 1;
}
if abs(self.x - player.x) < 8 * 0x200 && self.y - 8 * 0x200 < player.y && self.y + 96 * 0x200 > player.y
if abs(self.x - player.x) < 0x1000 && self.y - 0x1000 < player.y && self.y + 96 * 0x200 > player.y
{
self.action_num = 3;
self.anim_num = 0;
@ -400,7 +400,7 @@ impl NPC {
}
self.action_counter += 1;
if self.action_counter >= 20 && (self.flags.hit_bottom_wall() || self.y > player.y - 16 * 0x200) {
if self.action_counter >= 20 && (self.flags.hit_bottom_wall() || self.y > player.y - 0x2000) {
self.action_num = 5;
self.anim_num = 2;
self.anim_counter = 0;
@ -483,8 +483,8 @@ impl NPC {
let mut npc = NPC::create(103, &state.npc_table);
npc.cond.set_alive(true);
npc.x = self.x + self.direction.vector_x() * 8 * 0x200;
npc.y = self.y + 8 * 0x200;
npc.x = self.x + self.direction.vector_x() * 0x1000;
npc.y = self.y + 0x1000;
npc.direction = self.direction;
let _ = npc_list.spawn(0x100, npc);
@ -589,7 +589,7 @@ impl NPC {
self.vel_y += 0x10;
if self.flags.hit_bottom_wall() {
self.vel_y = -2 * 0x200;
self.vel_y = -0x400;
}
}
@ -673,7 +673,7 @@ impl NPC {
self.vel_y += 0x20;
if self.flags.hit_bottom_wall() {
self.vel_y = -2 * 0x200;
self.vel_y = -0x400;
}
self.vel_x = clamp(self.vel_x, -0x100, 0x100);
@ -696,7 +696,7 @@ impl NPC {
pub(crate) fn tick_n100_grate(&mut self, state: &mut SharedGameState) -> GameResult {
if self.action_num == 0 {
self.y += 16 * 0x200;
self.y += 0x2000;
self.action_num = 1;
self.anim_rect = if self.direction == Direction::Left {
@ -719,7 +719,7 @@ impl NPC {
pub(crate) fn tick_n102_malco_computer_wave(&mut self, state: &mut SharedGameState) -> GameResult {
if self.action_num == 0 {
self.action_num = 1;
self.y += 8 * 0x200;
self.y += 0x1000;
}
self.animate(0, 0, 3);
@ -1018,7 +1018,7 @@ impl NPC {
self.animate(4, 6, 9);
}
110 => {
npc_list.create_death_smoke(self.x, self.y, 16 * 0x200, 16, state, &self.rng);
npc_list.create_death_smoke(self.x, self.y, 0x2000, 16, state, &self.rng);
self.cond.set_alive(false);
}
_ => {}
@ -1058,7 +1058,7 @@ impl NPC {
if abs(self.x - player.x) < 32 * 0x200
&& self.y - 32 * 0x200 < player.y
&& self.y + 16 * 0x200 > player.y
&& self.y + 0x2000 > player.y
{
self.direction = if self.x > player.x { Direction::Left } else { Direction::Right };
}
@ -1356,14 +1356,14 @@ impl NPC {
match self.action_num {
0 => {
self.action_num = 1;
self.display_bounds = Rect { left: 16 * 0x200, top: 8 * 0x200, right: 16 * 0x200, bottom: 8 * 0x200 };
self.display_bounds = Rect { left: 0x2000, top: 0x1000, right: 0x2000, bottom: 0x1000 };
}
10 => {
self.action_num = 11;
self.anim_num = 1;
self.y -= 5 * 0x200;
self.display_bounds.top = 16 * 0x200;
self.display_bounds.bottom = 16 * 0x200
self.display_bounds.top = 0x2000;
self.display_bounds.bottom = 0x2000
}
20 | 21 => {
if self.action_num == 20 {
@ -1385,7 +1385,7 @@ impl NPC {
if self.action_num == 30 {
self.action_num = 31;
self.action_counter = 1;
self.vel_x = -4 * 0x200;
self.vel_x = -0x800;
self.x = self.target_x;
self.y = self.target_y;
@ -1411,7 +1411,7 @@ impl NPC {
self.action_counter = 2;
self.direction = Direction::Left;
self.y -= 48 * 0x200;
self.vel_x = -8 * 0x200;
self.vel_x = -0x1000;
}
self.x += self.vel_x;

View file

@ -186,8 +186,8 @@ impl NPC {
self.action_num = 0;
self.anim_num = 0;
self.damage = 0;
self.hit_bounds.left = 8 * 0x200;
self.hit_bounds.top = 16 * 0x200;
self.hit_bounds.left = 0x1000;
self.hit_bounds.top = 0x2000;
}
}
7 => {
@ -242,7 +242,7 @@ impl NPC {
npc.cond.set_alive(true);
npc.direction = Direction::Left;
npc.x = self.x;
npc.y = self.y + 4 * 0x200;
npc.y = self.y + 0x800;
npc.vel_x = vel_x;
npc.vel_y = vel_y;
@ -334,7 +334,7 @@ impl NPC {
self.anim_num = 1;
self.display_bounds.left = 12 * 0x200;
self.display_bounds.right = 12 * 0x200;
self.display_bounds.top = 8 * 0x200;
self.display_bounds.top = 0x1000;
}
if self.action_counter > 150 {

View file

@ -12,7 +12,7 @@ impl NPC {
0 | 1 => {
if self.action_num == 0 {
self.action_num = 1;
self.y -= 8 * 0x200;
self.y -= 0x1000;
}
self.anim_num = 0;
@ -116,14 +116,14 @@ impl NPC {
pub(crate) fn tick_n300_intro_demon_crown(&mut self, state: &mut SharedGameState) -> GameResult {
if self.action_num == 0 {
self.action_num = 1;
self.y += 6 * 0x200;
self.y += 0xc00;
self.anim_rect = state.constants.npc.n300_intro_demon_crown;
}
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 + 8 * 0x200,
self.y + 0x1000,
CaretType::LittleParticles, Direction::Up);
}

View file

@ -13,7 +13,7 @@ impl NPC {
match self.action_num {
0 | 1 => {
if self.action_num == 0 {
self.y += 3 * 0x200;
self.y += 0x600;
self.action_num = 1;
self.anim_num = 0;
}

View file

@ -228,7 +228,7 @@ impl NPC {
let player = self.get_closest_player_mut(players);
if (self.x - (32 * 0x200) < player.x) && (self.x + (32 * 0x200) > player.x)
&& (self.y - (32 * 0x200) < player.y) && (self.y + (16 * 0x200) > player.y) {
&& (self.y - (32 * 0x200) < player.y) && (self.y + (0x2000) > player.y) {
if self.x > player.x {
self.direction = Direction::Left;
} else {
@ -268,7 +268,7 @@ impl NPC {
self.npc_flags.set_shootable(false);
self.damage = 0;
self.action_num = 1;
self.hit_bounds.left = 4 * 0x200;
self.hit_bounds.left = 0x800;
}
self.anim_num = 0;
@ -300,7 +300,7 @@ impl NPC {
}
let player = self.get_closest_player_mut(players);
if abs(player.x - self.x) < 16 * 0x200 {
if abs(player.x - self.x) < 0x2000 {
self.hit_bounds.left = 18 * 0x200;
self.action_counter = 0;
self.action_num = 3;
@ -454,7 +454,7 @@ impl NPC {
pub(crate) fn tick_n091_mimiga_cage(&mut self, state: &SharedGameState) -> GameResult {
if self.action_num == 0 {
self.action_num = 1;
self.y += 16 * 0x200;
self.y += 0x2000;
self.anim_rect = state.constants.npc.n091_mimiga_cage;
}

View file

@ -17,7 +17,7 @@ impl NPC {
self.action_num = 1;
if self.direction == Direction::Right {
self.y += 16 * 0x200;
self.y += 0x2000;
}
}
@ -335,7 +335,7 @@ impl NPC {
self.action_num = 1;
if self.direction == Direction::Right {
self.y += 16 * 0x200;
self.y += 0x2000;
}
self.anim_rect = state.constants.npc.n021_chest_open;
@ -414,7 +414,7 @@ impl NPC {
if self.action_num == 0 {
self.action_num = 1;
self.anim_rect = state.constants.npc.n030_hermit_gunsmith[2];
self.y += 16 * 0x200;
self.y += 0x2000;
}
self.action_counter += 1;
@ -497,7 +497,7 @@ impl NPC {
self.action_num = 1;
self.layer = NPCLayer::Background;
self.anim_rect = state.constants.npc.n041_busted_door;
self.y -= 16 * 0x200;
self.y -= 0x2000;
}
Ok(())
@ -506,7 +506,7 @@ impl NPC {
pub(crate) fn tick_n043_chalkboard(&mut self, state: &mut SharedGameState) -> GameResult {
if self.action_num == 0 {
self.action_num = 1;
self.y -= 16 * 0x200;
self.y -= 0x2000;
match self.direction {
Direction::Left => self.anim_rect = state.constants.npc.n043_chalkboard[0],
@ -609,7 +609,7 @@ impl NPC {
self.cond.set_alive(false);
}
if self.y > stage.map.height as i32 * 16 * 0x200 {
if self.y > stage.map.height as i32 * 0x2000 {
// out of map
self.cond.set_alive(false);
}
@ -650,7 +650,7 @@ impl NPC {
self.anim_num = 0;
let player = self.get_closest_player_mut(players);
if abs(player.x - self.x) < 8 * 0x200 && player.y < self.y + 8 * 0x200 && player.y > self.y - 16 * 0x200
if abs(player.x - self.x) < 0x1000 && player.y < self.y + 0x1000 && player.y > self.y - 0x2000
{
state.sound_manager.play_sfx(43);
self.action_num = 1;
@ -724,7 +724,7 @@ impl NPC {
continue;
}
if abs(player.y - self.y) < 8 * 0x200 && player.x < self.x && player.x > self.x - 96 * 0x200 {
if abs(player.y - self.y) < 0x1000 && player.x < self.x && player.x > self.x - 96 * 0x200 {
player.vel_x -= 0x88;
player.cond.set_increase_acceleration(true);
}
@ -784,7 +784,7 @@ impl NPC {
continue;
}
if abs(player.x - self.x) < 8 * 0x200 && player.y < self.y && player.y > self.y - 96 * 0x200 {
if abs(player.x - self.x) < 0x1000 && player.y < self.y && player.y > self.y - 96 * 0x200 {
player.vel_y -= 0x88;
}
}
@ -839,7 +839,7 @@ impl NPC {
}
for player in players.iter_mut() {
if abs(player.y - self.y) < 8 * 0x200 && player.x > self.x && player.x < self.x + 96 * 0x200 {
if abs(player.y - self.y) < 0x1000 && player.x > self.x && player.x < self.x + 96 * 0x200 {
player.vel_x += 0x88;
player.cond.set_increase_acceleration(true);
}
@ -895,7 +895,7 @@ impl NPC {
}
for player in players.iter_mut() {
if abs(player.x - self.x) < 8 * 0x200 && player.y > self.y && player.y < self.y + 96 * 0x200 {
if abs(player.x - self.x) < 0x1000 && player.y > self.y && player.y < self.y + 96 * 0x200 {
player.vel_y -= 0x88;
}
}
@ -931,7 +931,7 @@ impl NPC {
let mut npc = NPC::create(105, &state.npc_table);
npc.cond.set_alive(true);
npc.x = self.x;
npc.y = self.y - 8 * 0x200;
npc.y = self.y - 0x1000;
let _ = npc_list.spawn(0x180, npc);
}
@ -949,7 +949,7 @@ impl NPC {
0 | 1 => {
if self.action_num == 0 {
self.action_num = 1;
self.y -= 4 * 0x200;
self.y -= 0x800;
}
if !self.flags.hit_bottom_wall() {
@ -1135,8 +1135,8 @@ impl NPC {
) -> GameResult {
match self.action_num {
0 => {
self.x += 8 * 0x200;
self.y += 8 * 0x200;
self.x += 0x1000;
self.y += 0x1000;
self.npc_flags.set_solid_hard(true);
self.vel_x = 0;
self.vel_y = 0;
@ -1147,7 +1147,7 @@ impl NPC {
self.damage = 0;
let player = self.get_closest_player_mut(players);
if (player.x < self.x + 25 * 0x200)
&& (player.x > self.x - 25 * 16 * 0x200)
&& (player.x > self.x - 25 * 0x2000)
&& (player.y < self.y + 25 * 0x200)
&& (player.y > self.y - 25 * 0x200)
{
@ -1198,7 +1198,7 @@ impl NPC {
let player = self.get_closest_player_mut(players);
if (player.x > self.x - 25 * 0x200)
&& (player.x < self.x + 25 * 16 * 0x200)
&& (player.x < self.x + 25 * 0x2000)
&& (player.y < self.y + 25 * 0x200)
&& (player.y > self.y - 25 * 0x200)
{
@ -1279,8 +1279,8 @@ impl NPC {
) -> GameResult {
match self.action_num {
0 => {
self.x += 8 * 0x200;
self.y += 8 * 0x200;
self.x += 0x1000;
self.y += 0x1000;
self.npc_flags.set_solid_hard(true);
self.vel_x = 0;
self.vel_y = 0;
@ -1291,7 +1291,7 @@ impl NPC {
self.damage = 0;
let player = self.get_closest_player_mut(players);
if (player.y < self.y + 25 * 0x200)
&& (player.y > self.y - 25 * 16 * 0x200)
&& (player.y > self.y - 25 * 0x2000)
&& (player.x < self.x + 25 * 0x200)
&& (player.x > self.x - 25 * 0x200)
{
@ -1342,7 +1342,7 @@ impl NPC {
let player = self.get_closest_player_mut(players);
if (player.y > self.y - 25 * 0x200)
&& (player.y < self.y + 25 * 16 * 0x200)
&& (player.y < self.y + 25 * 0x2000)
&& (player.x < self.x + 25 * 0x200)
&& (player.x > self.x - 25 * 0x200)
{
@ -1404,7 +1404,7 @@ impl NPC {
pub(crate) fn tick_n194_broken_blue_robot(&mut self, state: &mut SharedGameState) -> GameResult {
if self.action_num == 0 {
self.action_num = 1;
self.y += 4 * 0x200;
self.y += 0x800;
}
self.anim_rect = state.constants.npc.n194_broken_blue_robot;
@ -1517,7 +1517,7 @@ impl NPC {
pub(crate) fn tick_n234_red_flowers_picked(&mut self, state: &mut SharedGameState) -> GameResult {
if self.action_num == 0 {
self.action_num = 1;
self.y += 16 * 0x200;
self.y += 0x2000;
match self.direction {
Direction::Left => self.anim_rect = state.constants.npc.n234_red_flowers_picked[0],

View file

@ -32,7 +32,7 @@ impl NPC {
self.animate(1, 0, 1);
if (self.x - self.target_x).abs() < 3 * 0x200 && (self.y - self.target_y).abs() < 3 * 0x200 {
if (self.x - self.target_x).abs() < 0x600 && (self.y - self.target_y).abs() < 0x600 {
self.action_num = 2;
self.anim_num = 2;
state.sound_manager.play_sfx(21);
@ -49,7 +49,7 @@ impl NPC {
self.vel_x = clamp(self.vel_x, -0x5ff, 0x5ff);
self.vel_y = clamp(self.vel_y, -0x5ff, 0x5ff);
if self.y < -8 * 0x200 {
if self.y < -0x1000 {
self.cond.set_alive(false);
}
@ -133,7 +133,7 @@ impl NPC {
let mut npc = NPC::create(66, &state.npc_table);
npc.cond.set_alive(true);
npc.x = self.x;
npc.y = self.y - 16 * 0x200;
npc.y = self.y - 0x2000;
let _ = npc_list.spawn(0, npc);
}
@ -152,7 +152,7 @@ impl NPC {
self.vel_y -= 0x20;
if self.y < -8 * 0x200 {
if self.y < -0x1000 {
self.cond.set_alive(false);
}
}
@ -253,7 +253,7 @@ impl NPC {
let mut npc = NPC::create(66, &state.npc_table);
npc.x = self.x;
npc.y = self.y - 16 * 0x200;
npc.y = self.y - 0x2000;
npc.cond.set_alive(true);
let _ = npc_list.spawn(0, npc);
@ -273,7 +273,7 @@ impl NPC {
self.vel_y -= 0x20;
if self.y < -8 * 0x200 {
if self.y < -0x1000 {
self.cond.set_alive(false);
}
}
@ -338,8 +338,8 @@ impl NPC {
state.sound_manager.play_sfx(33);
let mut npc = NPC::create(11, &state.npc_table);
npc.x = self.x + 8 * 0x200;
npc.y = self.y - 8 * 0x200;
npc.x = self.x + 0x1000;
npc.y = self.y - 0x1000;
npc.vel_x = 0x600;
npc.vel_y = self.rng.range(-0x200..0) as i32;
npc.cond.set_alive(true);

View file

@ -21,7 +21,7 @@ impl NPC {
}
let player = self.get_closest_player_mut(players);
if abs(self.x - player.x) < 12 * 0x200 && player.y > self.y && player.y < self.y + 8 * 0x200 {
if abs(self.x - player.x) < 12 * 0x200 && player.y > self.y && player.y < self.y + 0x1000 {
self.action_num = 15;
self.action_counter = 0;
}

View file

@ -13,7 +13,7 @@ impl NPC {
0 => {
self.action_num = 1;
self.anim_num = 0;
self.y -= 16 * 0x200;
self.y -= 0x2000;
}
1 => {
self.action_counter += 1;
@ -26,7 +26,7 @@ impl NPC {
}
2 => {
if self.vel_y > 0 {
self.hit_bounds.bottom = 16 * 0x200;
self.hit_bounds.bottom = 0x2000;
}
if self.flags.hit_bottom_wall() {
@ -82,8 +82,8 @@ impl NPC {
self.action_num = 1;
self.anim_num = 0;
self.anim_counter = 0;
self.x += 16 * 0x200;
self.y += 8 * 0x200;
self.x += 0x2000;
self.y += 0x1000;
state.sound_manager.play_sfx(29);
}
@ -99,7 +99,7 @@ impl NPC {
if self.action_counter > 20 {
self.action_num = 3;
self.anim_num = 1;
self.hit_bounds.bottom = 8 * 0x200;
self.hit_bounds.bottom = 0x1000;
}
}
3 => {

View file

@ -225,13 +225,13 @@ impl NPC {
}
let player = self.get_closest_player_mut(players);
if abs(self.x - player.x) < 8 * 0x200 && player.y > self.y && player.y < self.y + 8 * 0x200 {
if abs(self.x - player.x) < 0x1000 && player.y > self.y && player.y < self.y + 0x1000 {
self.action_num = 2;
self.action_counter = 0;
state.sound_manager.play_sfx(102);
}
self.x += (player.x - self.x).signum() * 2 * 0x200;
self.x += (player.x - self.x).signum() * 0x400;
}
2 => {
self.anim_counter += 1;
@ -1051,8 +1051,8 @@ impl NPC {
0 | 1 => {
if self.action_num == 0 {
self.action_num = 1;
self.x += 8 * 0x200;
self.y += 8 * 0x200;
self.x += 0x1000;
self.y += 0x1000;
}
self.npc_flags.set_ignore_solidity(false);

View file

@ -25,7 +25,7 @@ impl NPC {
let player = self.get_closest_player_mut(players);
if abs(self.x - player.x) < 32 * 0x200
&& self.y - 32 * 0x200 < player.y && self.y + 16 * 0x200 > player.y {
&& self.y - 32 * 0x200 < player.y && self.y + 0x2000 > player.y {
self.direction = if self.x > player.x {
Direction::Left
} else {

View file

@ -118,8 +118,8 @@ impl NPC {
if let Some(npc) = self.get_parent_ref_mut(npc_list) {
self.direction = npc.direction.opposite();
self.x = npc.x + npc.direction.vector_x() * 6 * 0x200;
self.y = npc.y + 4 * 0x200;
self.x = npc.x + npc.direction.vector_x() * 0xc00;
self.y = npc.y + 0x800;
if npc.anim_num == 2 || npc.anim_num == 4 {
self.y -= 0x200;
@ -145,7 +145,7 @@ impl NPC {
state.npc_super_pos = (
self.x - 24 * 0x200,
self.y - 8 * 0x200
self.y - 0x1000
);
}
17 => {
@ -154,7 +154,7 @@ impl NPC {
state.npc_super_pos = (
self.x,
self.y - 8 * 0x200
self.y - 0x1000
);
}
20 | 21 => {
@ -176,7 +176,7 @@ impl NPC {
self.vel_x = self.direction.vector_x() * 0x400;
let player = self.get_closest_player_mut(players);
if self.x < player.x - 8 * 0x200 {
if self.x < player.x - 0x1000 {
self.direction = Direction::Right;
self.action_num = 0;
}
@ -234,8 +234,8 @@ impl NPC {
self.action_counter = 0;
self.anim_counter = 0;
self.x -= 4 * 0x200;
self.y += 16 * 0x200;
self.x -= 0x800;
self.y += 0x2000;
}
self.anim_counter += 1;

View file

@ -26,10 +26,10 @@ impl NPC {
}
let player = self.get_closest_player_mut(players);
if (self.x - (16 * 0x200) < player.x)
&& (self.x + (16 * 0x200) > player.x)
&& (self.y - (16 * 0x200) < player.y)
&& (self.y + (16 * 0x200) > player.y)
if (self.x - (0x2000) < player.x)
&& (self.x + (0x2000) > player.x)
&& (self.y - (0x2000) < player.y)
&& (self.y + (0x2000) > player.y)
{
if self.x > player.x {
self.direction = Direction::Left;