caret fix

This commit is contained in:
Alula 2020-08-23 04:17:24 +02:00
parent 139350d5e1
commit ce1da83cfd
No known key found for this signature in database
GPG Key ID: 3E00485503A1D8BA
2 changed files with 24 additions and 5 deletions

View File

@ -90,7 +90,7 @@ impl Caret {
self.anim_rect = constants.caret.exhaust_rects[self.anim_num];
match self.direct {
Direction::Left => { self.x -= 0x400; }
Direction::Left => { self.x -= 0x400; } // 2.0fix9
Direction::Up => { self.y -= 0x400; }
Direction::Right => { self.x += 0x400; }
Direction::Bottom => { self.y += 0x400; }
@ -100,7 +100,7 @@ impl Caret {
CaretType::QuestionMark => {
self.anim_wait += 1;
if self.anim_wait < 5 {
self.y -= 0x800;
self.y -= 0x800; // 4.0fix9
}
if self.anim_wait == 32 {
@ -120,8 +120,8 @@ impl Caret {
if self.anim_num == 0 {
match self.direct {
Direction::Left => {
self.vel_x = rng.range(-0x300..0x300) as isize;
self.vel_y = rng.range(-0x100..0x100) as isize;
self.vel_x = rng.range(-0x300..0x300) as isize; // -1.5fix9..1.5fix9
self.vel_y = rng.range(-0x100..0x100) as isize; // -0.5fix9..0.5fix9
}
Direction::Up => {
self.vel_y = rng.range(1..3) as isize * 0x100;
@ -140,7 +140,7 @@ impl Caret {
self.x += self.vel_x;
self.y += self.vel_y;
if self.anim_num == 21 {
if self.anim_num == 20 {
self.cond.set_visible(false);
return;
}

View File

@ -34,6 +34,24 @@ impl Direction {
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)]
@ -148,6 +166,7 @@ macro_rules! bitfield_fields {
}
paste::paste! {
#[allow(dead_code)]
$($vis)* fn [<only_ $getter>](&self) -> bool {
use crate::common::Bit;
self.bit_only($bit)