mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
cargo clippy fixes in examples
This commit is contained in:
parent
c90e8de893
commit
467ebb0240
|
@ -207,7 +207,7 @@ impl RolledDice {
|
||||||
let heal = *face_counts.entry(Face::Heal).or_default();
|
let heal = *face_counts.entry(Face::Heal).or_default();
|
||||||
if heal != 0 {
|
if heal != 0 {
|
||||||
actions.push(Action::PlayerHeal {
|
actions.push(Action::PlayerHeal {
|
||||||
amount: ((heal * (heal + 1)) / 2) as u32,
|
amount: (heal * (heal + 1)) / 2,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl<'a> Level<'a> {
|
||||||
let factor: Number = Number::new(1) / Number::new(8);
|
let factor: Number = Number::new(1) / Number::new(8);
|
||||||
let (x, y) = (v * factor).floor().get();
|
let (x, y) = (v * factor).floor().get();
|
||||||
|
|
||||||
if (x < 0 || x > tilemap::WIDTH as i32) || (y < 0 || y > tilemap::HEIGHT as i32) {
|
if !(0..=tilemap::WIDTH).contains(&x) || !(0..=tilemap::HEIGHT).contains(&y) {
|
||||||
return Some(Rect::new((x * 8, y * 8).into(), (8, 8).into()));
|
return Some(Rect::new((x * 8, y * 8).into(), (8, 8).into()));
|
||||||
}
|
}
|
||||||
let position = tilemap::WIDTH as usize * y as usize + x as usize;
|
let position = tilemap::WIDTH as usize * y as usize + x as usize;
|
||||||
|
@ -1878,7 +1878,7 @@ enum MoveState {
|
||||||
impl<'a> Game<'a> {
|
impl<'a> Game<'a> {
|
||||||
fn has_just_reached_end(&self) -> bool {
|
fn has_just_reached_end(&self) -> bool {
|
||||||
match self.boss {
|
match self.boss {
|
||||||
BossState::NotSpawned => self.offset.x.floor() + 248 >= tilemap::WIDTH as i32 * 8,
|
BossState::NotSpawned => self.offset.x.floor() + 248 >= tilemap::WIDTH * 8,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1901,13 +1901,13 @@ impl<'a> Game<'a> {
|
||||||
|
|
||||||
if self.has_just_reached_end() {
|
if self.has_just_reached_end() {
|
||||||
sfx.boss();
|
sfx.boss();
|
||||||
self.offset.x = (tilemap::WIDTH as i32 * 8 - 248).into();
|
self.offset.x = (tilemap::WIDTH * 8 - 248).into();
|
||||||
self.move_state = MoveState::PinnedAtEnd;
|
self.move_state = MoveState::PinnedAtEnd;
|
||||||
self.boss = BossState::Active(Boss::new(object_controller, self.offset))
|
self.boss = BossState::Active(Boss::new(object_controller, self.offset))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MoveState::PinnedAtEnd => {
|
MoveState::PinnedAtEnd => {
|
||||||
self.offset.x = (tilemap::WIDTH as i32 * 8 - 248).into();
|
self.offset.x = (tilemap::WIDTH * 8 - 248).into();
|
||||||
}
|
}
|
||||||
MoveState::FollowingPlayer => {
|
MoveState::FollowingPlayer => {
|
||||||
Game::update_sunrise(vram, self.sunrise_timer);
|
Game::update_sunrise(vram, self.sunrise_timer);
|
||||||
|
@ -1917,8 +1917,8 @@ impl<'a> Game<'a> {
|
||||||
let difference = self.player.entity.position.x - (self.offset.x + WIDTH / 2);
|
let difference = self.player.entity.position.x - (self.offset.x + WIDTH / 2);
|
||||||
|
|
||||||
self.offset.x += difference / 8;
|
self.offset.x += difference / 8;
|
||||||
if self.offset.x > (tilemap::WIDTH as i32 * 8 - 248).into() {
|
if self.offset.x > (tilemap::WIDTH * 8 - 248).into() {
|
||||||
self.offset.x = (tilemap::WIDTH as i32 * 8 - 248).into();
|
self.offset.x = (tilemap::WIDTH * 8 - 248).into();
|
||||||
} else if self.offset.x < 8.into() {
|
} else if self.offset.x < 8.into() {
|
||||||
self.offset.x = 8.into();
|
self.offset.x = 8.into();
|
||||||
self.move_state = MoveState::Ending;
|
self.move_state = MoveState::Ending;
|
||||||
|
|
Loading…
Reference in a new issue