mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-23 06:02:55 +00:00
Ironhead Switch fixes
This commit is contained in:
parent
46045c2a7e
commit
924f23154b
|
@ -10,8 +10,8 @@ use crate::shared_game_state::SharedGameState;
|
|||
impl NPC {
|
||||
pub(crate) fn tick_n196_ironhead_wall(&mut self, state: &mut SharedGameState) -> GameResult {
|
||||
self.x -= 0xC00;
|
||||
if self.x <= 0x26000 {
|
||||
self.x += 0x2C000;
|
||||
if self.x <= if !state.constants.is_switch { 0x26000 } else { 0x1E000 } {
|
||||
self.x += if !state.constants.is_switch { 0x2C000 } else { 0x3C000 };
|
||||
}
|
||||
|
||||
let dir_offset = if self.direction == Direction::Left { 0 } else { 1 };
|
||||
|
@ -224,13 +224,14 @@ impl BossNPC {
|
|||
}
|
||||
250 | 251 => {
|
||||
let player = self.parts[0].get_closest_player_ref(&players);
|
||||
let switch_buffer = if state.constants.is_switch { 0x6000 } else { 0 }; // Buffer to stop Ironhead's teleport to be visible
|
||||
if self.parts[0].action_num == 250 {
|
||||
self.parts[0].action_num = 251;
|
||||
if self.parts[0].direction == Direction::Right {
|
||||
self.parts[0].x = 0x1E000;
|
||||
self.parts[0].x = 0x1E000 - switch_buffer;
|
||||
self.parts[0].y = player.y;
|
||||
} else {
|
||||
self.parts[0].x = 0x5A000;
|
||||
self.parts[0].x = 0x5A000 + switch_buffer;
|
||||
self.parts[0].y = self.parts[0].rng.range(2..13) * state.tile_size.as_int() * 0x200;
|
||||
}
|
||||
|
||||
|
@ -259,11 +260,11 @@ impl BossNPC {
|
|||
self.parts[0].y += self.parts[0].vel_y;
|
||||
|
||||
if self.parts[0].direction == Direction::Right {
|
||||
if self.parts[0].x > 0x5A000 {
|
||||
if self.parts[0].x > 0x5A000 + switch_buffer {
|
||||
self.parts[0].direction = Direction::Left;
|
||||
self.parts[0].action_num = 100;
|
||||
}
|
||||
} else if self.parts[0].x < 0x22000 {
|
||||
} else if self.parts[0].x < 0x22000 - switch_buffer {
|
||||
self.parts[0].direction = Direction::Right;
|
||||
self.parts[0].action_num = 100;
|
||||
}
|
||||
|
|
|
@ -1695,10 +1695,11 @@ impl Scene for GameScene {
|
|||
//graphics::set_canvas(ctx, Some(&state.game_canvas));
|
||||
|
||||
if self.player1.control_mode == ControlMode::IronHead {
|
||||
let x_size = if !state.constants.is_switch { 320.0 } else { 426.0 };
|
||||
let clip_rect: Rect = Rect::new_size(
|
||||
(((state.canvas_size.0 - 320.0) * 0.5) * state.scale) as _,
|
||||
(((state.canvas_size.0 - x_size) * 0.5) * state.scale) as _,
|
||||
(((state.canvas_size.1 - 240.0) * 0.5) * state.scale) as _,
|
||||
(320.0 * state.scale) as _,
|
||||
(x_size * state.scale) as _,
|
||||
(240.0 * state.scale) as _,
|
||||
);
|
||||
graphics::set_clip_rect(ctx, Some(clip_rect))?;
|
||||
|
|
Loading…
Reference in a new issue