From 7e793e09a803dc25d6cb75f3453c88679e88c0a1 Mon Sep 17 00:00:00 2001 From: dawnDus <96957561+dawndus@users.noreply.github.com> Date: Tue, 26 Apr 2022 23:23:14 -0400 Subject: [PATCH] Bug Fixes --- src/components/nikumaru.rs | 2 +- src/npc/ai/plantation.rs | 6 +++--- src/scene/game_scene.rs | 10 ++++++---- src/settings.rs | 1 + src/weapon/bullet.rs | 8 ++++---- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/nikumaru.rs b/src/components/nikumaru.rs index 17fe18a..d4adb09 100644 --- a/src/components/nikumaru.rs +++ b/src/components/nikumaru.rs @@ -63,7 +63,7 @@ impl NikumaruCounter { let mut random_list: [u8; 4] = [0; 4]; for iter in 0..=3 { - random_list[iter] = state.game_rng.range(0..250) as u8 + iter as u8; + random_list[iter] = state.effect_rng.range(0..250) as u8 + iter as u8; ticks[iter] = u32::from_le_bytes([ ticks[iter].to_le_bytes()[0].wrapping_add(random_list[iter]), diff --git a/src/npc/ai/plantation.rs b/src/npc/ai/plantation.rs index f594e78..d07f65d 100644 --- a/src/npc/ai/plantation.rs +++ b/src/npc/ai/plantation.rs @@ -1130,9 +1130,9 @@ impl NPC { } if player.x > self.x + 0x28000 - && player.x < self.x - 0x28000 - && player.y > self.y + 0x1e000 - && player.y < self.y - 0x1e000 + || player.x < self.x - 0x28000 + || player.y > self.y + 0x1e000 + || player.y < self.y - 0x1e000 { self.action_num = 0; } diff --git a/src/scene/game_scene.rs b/src/scene/game_scene.rs index 07c0179..7c3142c 100644 --- a/src/scene/game_scene.rs +++ b/src/scene/game_scene.rs @@ -1105,12 +1105,12 @@ impl GameScene { if npc.flags.water_splash_facing_right() { Direction::Right } else { Direction::Left }; for _ in 0..7 { - droplet.x = npc.x + (state.game_rng.range(-8..8) * 0x200) as i32; + droplet.x = npc.x + (npc.rng.range(-8..8) * 0x200) as i32; - droplet.vel_x = npc.vel_x + state.game_rng.range(-0x200..0x200); + droplet.vel_x = npc.vel_x + npc.rng.range(-0x200..0x200); droplet.vel_y = match () { - _ if vertical_splash => state.game_rng.range(-0x200..0x80) - (npc.vel_y / 2), - _ if horizontal_splash => state.game_rng.range(-0x200..0x80), + _ if vertical_splash => npc.rng.range(-0x200..0x80) - (npc.vel_y / 2), + _ if horizontal_splash => npc.rng.range(-0x200..0x80), _ => 0, }; @@ -1656,6 +1656,8 @@ impl Scene for GameScene { // I'd personally set it to something higher but left it as is for accuracy. state.water_level = 0x1e0000; + state.carets.clear(); + self.lighting_mode = match () { _ if self.intro_mode => LightingMode::None, _ if !state.constants.is_switch diff --git a/src/settings.rs b/src/settings.rs index 5fc7d17..c389133 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -51,6 +51,7 @@ pub struct Settings { #[serde(default = "default_vsync")] pub vsync_mode: VSyncMode, pub debug_mode: bool, + #[serde(skip)] pub noclip: bool, } diff --git a/src/weapon/bullet.rs b/src/weapon/bullet.rs index dbe9e37..7e7c4ae 100644 --- a/src/weapon/bullet.rs +++ b/src/weapon/bullet.rs @@ -204,7 +204,7 @@ impl Bullet { if self.action_num == 0 { self.action_num = 1; - self.anim_num = state.game_rng.range(0..2) as u16; + self.anim_num = state.effect_rng.range(0..2) as u16; match self.direction { Direction::Left => self.vel_x = -0x600, @@ -235,7 +235,7 @@ impl Bullet { if self.action_num == 0 { self.action_num = 1; - self.anim_num = state.game_rng.range(0..2) as u16; + self.anim_num = state.effect_rng.range(0..2) as u16; match self.direction { Direction::Left => { @@ -1959,8 +1959,8 @@ impl PhysicalEntity for Bullet { npc.y = (y * 16 + 8) * 0x200; for _ in 0..4 { - npc.vel_x = state.game_rng.range(-0x200..0x200) as i32; - npc.vel_y = state.game_rng.range(-0x200..0x200) as i32; + npc.vel_x = npc.rng.range(-0x200..0x200) as i32; + npc.vel_y = npc.rng.range(-0x200..0x200) as i32; let _ = npc_list.spawn(0x100, npc.clone()); }