Assorted bugs #60

This commit is contained in:
dawnDus 2022-02-09 23:00:02 -05:00
parent 0369b37d10
commit c722582ff2
No known key found for this signature in database
GPG Key ID: 972AABDE81848F21
9 changed files with 26 additions and 13 deletions

View File

@ -53,6 +53,7 @@ impl NPC {
// interpolation glitch fix
self.prev_x = self.x;
self.prev_y = self.y;
state.sound_manager.play_sfx(29);
}
self.action_counter += 1;

View File

@ -84,6 +84,9 @@ impl NPC {
self.anim_num = 0;
self.anim_counter = 0;
self.vel_x = 0;
if self.tsc_direction == 20 {
self.direction = Direction::Right;
}
}
if self.rng.range(0..120) == 10 {

View File

@ -87,13 +87,13 @@ impl NPC {
}
self.anim_num = 7;
self.vel_x = self.direction.vector_x() * 0x200;
self.vel_x = self.direction.vector_x() * -0x200;
self.vel_y += 0x40;
self.action_counter += 1;
if self.action_counter > 0 && self.flags.hit_bottom_wall() {
self.action_num = 32;
}
self.action_counter += 1;
}
32 => {
self.vel_x = 0;
@ -708,7 +708,7 @@ impl NPC {
bullet_manager.create_bullet(
self.x + 0x400,
self.y - 0x800,
12,
6,
TargetPlayer::Player1,
Direction::Up,
&state.constants,
@ -718,7 +718,7 @@ impl NPC {
bullet_manager.create_bullet(
self.x - 0x400,
self.y - 0x800,
12,
6,
TargetPlayer::Player1,
Direction::Up,
&state.constants,
@ -729,7 +729,7 @@ impl NPC {
bullet_manager.create_bullet(
self.x + 0x800,
self.y + 0x600,
12,
6,
TargetPlayer::Player1,
Direction::Right,
&state.constants,
@ -739,7 +739,7 @@ impl NPC {
bullet_manager.create_bullet(
self.x - 0x800,
self.y + 0x600,
12,
6,
TargetPlayer::Player1,
Direction::Left,
&state.constants,

View File

@ -1603,6 +1603,8 @@ impl NPC {
let mut npc = NPC::create(4, &state.npc_table);
npc.x = self.x + self.rng.range(-20..20) * 0x200;
npc.y = self.y;
npc.cond.set_alive(true);
npc.vel_y = -0x200;
let _ = npc_list.spawn(0x100, npc);
}

View File

@ -526,7 +526,9 @@ impl NPC {
self.x += self.vel_x;
self.y += self.vel_y;
self.anim_rect = state.constants.npc.n232_orangebell[self.anim_num as usize];
let dir_offset = if self.direction == Direction::Left { 0 } else { 3 };
self.anim_rect = state.constants.npc.n232_orangebell[self.anim_num as usize + dir_offset];
Ok(())
}
@ -788,6 +790,8 @@ impl NPC {
self.vel_y = self.vel_y.clamp(-0x100, 0x100);
self.y += self.vel_y;
let dir_offset = if self.direction == Direction::Left { 0 } else { 6 };
self.anim_rect = state.constants.npc.n236_gunfish[dir_offset + self.anim_num as usize];

View File

@ -16,7 +16,7 @@ impl NPC {
self.cond.set_alive(false);
}
if self.flags.in_water() {
if (self.y - 0x800) > state.water_level {
self.x += self.vel_x / 2;
self.y += self.vel_y / 2;
} else {

View File

@ -896,7 +896,7 @@ pub trait PhysicalEntity {
}
}
if self.is_player() && (self.y() - 0x800) > state.water_level {
if (self.y() - 0x800) > state.water_level {
self.flags().set_in_water(true);
}
}

View File

@ -1219,6 +1219,9 @@ impl GameScene {
}
npc.shock = 8;
npc = unsafe { self.boss.parts.get_unchecked_mut(i) };
npc.shock = 8;
}
bullet.life = bullet.life.saturating_sub(1);

View File

@ -1327,7 +1327,7 @@ impl TextScriptVM {
if direction == Direction::FacingPlayer {
npc.direction =
if game_scene.player1.x < npc.x { Direction::Left } else { Direction::Right };
} else {
} else if tsc_direction != 5 {
npc.direction = direction;
}
}
@ -1380,7 +1380,7 @@ impl TextScriptVM {
if direction == Direction::FacingPlayer {
npc.direction =
if game_scene.player1.x < npc.x { Direction::Left } else { Direction::Right };
} else {
} else if tsc_direction != 5 {
npc.direction = direction;
}
@ -1417,7 +1417,7 @@ impl TextScriptVM {
if direction == Direction::FacingPlayer {
npc.direction =
if game_scene.player1.x < npc.x { Direction::Left } else { Direction::Right };
} else {
} else if tsc_direction != 5 {
npc.direction = direction;
}
@ -1442,7 +1442,7 @@ impl TextScriptVM {
npc.tsc_direction = tsc_direction as u16;
if direction == Direction::FacingPlayer {
npc.direction = if game_scene.player1.x < npc.x { Direction::Right } else { Direction::Left };
npc.direction = if game_scene.player1.x < npc.x { Direction::Left } else { Direction::Right };
} else {
npc.direction = direction;
}