1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-07-15 17:25:37 +00:00

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 // interpolation glitch fix
self.prev_x = self.x; self.prev_x = self.x;
self.prev_y = self.y; self.prev_y = self.y;
state.sound_manager.play_sfx(29);
} }
self.action_counter += 1; self.action_counter += 1;

View file

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

View file

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

View file

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

View file

@ -526,7 +526,9 @@ impl NPC {
self.x += self.vel_x; self.x += self.vel_x;
self.y += self.vel_y; 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(()) Ok(())
} }
@ -788,6 +790,8 @@ impl NPC {
self.vel_y = self.vel_y.clamp(-0x100, 0x100); 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 }; 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]; 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); self.cond.set_alive(false);
} }
if self.flags.in_water() { if (self.y - 0x800) > state.water_level {
self.x += self.vel_x / 2; self.x += self.vel_x / 2;
self.y += self.vel_y / 2; self.y += self.vel_y / 2;
} else { } 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); self.flags().set_in_water(true);
} }
} }

View file

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

View file

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