mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-11-30 16:18:00 +00:00
commit
fb5a72c565
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ use crate::npc::boss::BossNPC;
|
|||
use crate::npc::list::NPCList;
|
||||
use crate::npc::{NPCLayer, NPC};
|
||||
use crate::physics::{PhysicalEntity, OFFSETS};
|
||||
use crate::player::{Player, TargetPlayer};
|
||||
use crate::player::{ControlMode, Player, TargetPlayer};
|
||||
use crate::rng::XorShift;
|
||||
use crate::scene::title_scene::TitleScene;
|
||||
use crate::scene::Scene;
|
||||
|
|
@ -1733,6 +1733,18 @@ impl Scene for GameScene {
|
|||
|
||||
fn draw(&self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
||||
//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 - x_size) * 0.5) * state.scale) as _,
|
||||
(((state.canvas_size.1 - 240.0) * 0.5) * state.scale) as _,
|
||||
(x_size * state.scale) as _,
|
||||
(240.0 * state.scale) as _,
|
||||
);
|
||||
graphics::set_clip_rect(ctx, Some(clip_rect))?;
|
||||
}
|
||||
|
||||
let stage_textures_ref = &*self.stage_textures.deref().borrow();
|
||||
self.background.draw(state, ctx, &self.frame, stage_textures_ref, &self.stage)?;
|
||||
self.tilemap.draw(state, ctx, &self.frame, TileLayer::Background, stage_textures_ref, &self.stage)?;
|
||||
|
|
@ -1771,6 +1783,10 @@ impl Scene for GameScene {
|
|||
|
||||
self.draw_black_bars(state, ctx)?;
|
||||
|
||||
if self.player1.control_mode == ControlMode::IronHead {
|
||||
graphics::set_clip_rect(ctx, None)?;
|
||||
}
|
||||
|
||||
if self.inventory_dim > 0.0 {
|
||||
let rect = Rect::new(0, 0, state.screen_size.0 as isize + 1, state.screen_size.1 as isize + 1);
|
||||
let mut dim_color = state.constants.inventory_dim_color;
|
||||
|
|
|
|||
Loading…
Reference in a new issue