mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-11-26 06:08:16 +00:00
caret fix
This commit is contained in:
parent
139350d5e1
commit
ce1da83cfd
10
src/caret.rs
10
src/caret.rs
|
|
@ -90,7 +90,7 @@ impl Caret {
|
||||||
self.anim_rect = constants.caret.exhaust_rects[self.anim_num];
|
self.anim_rect = constants.caret.exhaust_rects[self.anim_num];
|
||||||
|
|
||||||
match self.direct {
|
match self.direct {
|
||||||
Direction::Left => { self.x -= 0x400; }
|
Direction::Left => { self.x -= 0x400; } // 2.0fix9
|
||||||
Direction::Up => { self.y -= 0x400; }
|
Direction::Up => { self.y -= 0x400; }
|
||||||
Direction::Right => { self.x += 0x400; }
|
Direction::Right => { self.x += 0x400; }
|
||||||
Direction::Bottom => { self.y += 0x400; }
|
Direction::Bottom => { self.y += 0x400; }
|
||||||
|
|
@ -100,7 +100,7 @@ impl Caret {
|
||||||
CaretType::QuestionMark => {
|
CaretType::QuestionMark => {
|
||||||
self.anim_wait += 1;
|
self.anim_wait += 1;
|
||||||
if self.anim_wait < 5 {
|
if self.anim_wait < 5 {
|
||||||
self.y -= 0x800;
|
self.y -= 0x800; // 4.0fix9
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.anim_wait == 32 {
|
if self.anim_wait == 32 {
|
||||||
|
|
@ -120,8 +120,8 @@ impl Caret {
|
||||||
if self.anim_num == 0 {
|
if self.anim_num == 0 {
|
||||||
match self.direct {
|
match self.direct {
|
||||||
Direction::Left => {
|
Direction::Left => {
|
||||||
self.vel_x = rng.range(-0x300..0x300) as isize;
|
self.vel_x = rng.range(-0x300..0x300) as isize; // -1.5fix9..1.5fix9
|
||||||
self.vel_y = rng.range(-0x100..0x100) as isize;
|
self.vel_y = rng.range(-0x100..0x100) as isize; // -0.5fix9..0.5fix9
|
||||||
}
|
}
|
||||||
Direction::Up => {
|
Direction::Up => {
|
||||||
self.vel_y = rng.range(1..3) as isize * 0x100;
|
self.vel_y = rng.range(1..3) as isize * 0x100;
|
||||||
|
|
@ -140,7 +140,7 @@ impl Caret {
|
||||||
self.x += self.vel_x;
|
self.x += self.vel_x;
|
||||||
self.y += self.vel_y;
|
self.y += self.vel_y;
|
||||||
|
|
||||||
if self.anim_num == 21 {
|
if self.anim_num == 20 {
|
||||||
self.cond.set_visible(false);
|
self.cond.set_visible(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,24 @@ impl Direction {
|
||||||
Direction::Bottom => { Direction::Up }
|
Direction::Bottom => { Direction::Up }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn vector_x(&self) -> isize {
|
||||||
|
match self {
|
||||||
|
Direction::Left => { -1 }
|
||||||
|
Direction::Up => { 0 }
|
||||||
|
Direction::Right => { 1 }
|
||||||
|
Direction::Bottom => { 0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn vector_y(&self) -> isize {
|
||||||
|
match self {
|
||||||
|
Direction::Left => { 0 }
|
||||||
|
Direction::Up => { -1 }
|
||||||
|
Direction::Right => { 0 }
|
||||||
|
Direction::Bottom => { 1 }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
|
@ -148,6 +166,7 @@ macro_rules! bitfield_fields {
|
||||||
}
|
}
|
||||||
|
|
||||||
paste::paste! {
|
paste::paste! {
|
||||||
|
#[allow(dead_code)]
|
||||||
$($vis)* fn [<only_ $getter>](&self) -> bool {
|
$($vis)* fn [<only_ $getter>](&self) -> bool {
|
||||||
use crate::common::Bit;
|
use crate::common::Bit;
|
||||||
self.bit_only($bit)
|
self.bit_only($bit)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue